akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <algorithm>
#include <vector>
#include <list>
#include <string>
#include <cstdlib>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cstring>
#include <climits>

using namespace std;

typedef long long ll;
typedef vector<int> veci;

int main() {
    int N, M;
    string s[100], t[100];
    cin >> N;
    for (int i =0; i < N; i++) cin >> s[i];
    cin >> M;
    for (int i =0; i < M; i++) cin >> t[i];

    int m = 0;
    for (int i = 0;  i < N; i++) {
        int count = 1;
        string str = s[i];
        for (int j = 0; j < N; j++) {
            if (i != j) {
                if (str == s[j]) count++;
            }
        }
        for (int j = 0; j < M; j++) {
            if (str == t[j]) count--;
        }
        m = max(m, count);
    }

    cout << m << endl;

    return 0;
}


Measured memory_bytes: 256
import itertools

n, k = map(int, input().split())
if k > (n - 1) * (n - 2) // 2:
    print(-1)
else:
    tmp = (n - 1) * (n - 2) // 2
    tmp -= k
    print(n - 1 + tmp)
    for i in range(1, n):
        print(i, n)
    if tmp == 0:
        exit()
    for lst in itertools.combinations(range(1, n), 2):
        print(lst[0], lst[1])
        tmp -= 1
        if tmp == 0:
            break

Measured memory_bytes: 3616
// g++ -std=c++11 a.cpp
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>	
#include<map>
#include<set>
#include<utility>
#include<cmath>
#include<random>
#include<cstring>
#include<queue>
#include<stack>
#include<bitset>
#include<cstdio>
#include<sstream>
#include<iomanip>
#include<assert.h>
#include<typeinfo>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
using namespace std;
//kaewasuretyuui
typedef long long ll;
//#define int ll
typedef int Def;
//typedef ll Def;
typedef pair<Def,Def> pii;
typedef vector<Def> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<Def,pii> pip;
typedef vector<pip>vip;
#define mt make_tuple
typedef tuple<int,int,int> tp;
typedef vector<tp> vt;
template<typename A,typename B>bool cmin(A &a,const B &b){return a>b?(a=b,true):false;}
template<typename A,typename B>bool cmax(A &a,const B &b){return a<b?(a=b,true):false;}
//template<class C>constexpr int size(const C &c){return (int)c.size();}
//template<class T,size_t N> constexpr int size(const T (&xs)[N])noexcept{return (int)N;}
const double PI=acos(-1);
const double EPS=1e-7;
Def inf = sizeof(Def) == sizeof(long long) ? 2e18 : 1e9+10;
int dx[]={0,1,0,-1};
int dy[]={1,0,-1,0};
int main(){
	int n,m,q;
	cin>>n>>m>>q;
	int a=0,b=0;
	rep(i,m){
		int x;cin>>x;
		if(x<q)a++;
		else b++;
	}
	cout<<min(a,b)<<endl;
}












Measured memory_bytes: 256
import numpy as np

N = int(input())
CSF = [
  [int(i) for i in input().split()]
  for _ in range(N-1)]
CSF.append([0, 0, 1])

ans = []

for n in range(N-1):
    c, s, f = CSF[n]
    cn, sn, fn = CSF[n+1]
    
    for m in range(N-n-2):
                
        if s+c > sn:
            sn = int(np.ceil((s+c)/fn)*fn)
        c, s, f = cn, sn, fn
        cn, sn, fn = CSF[n+m+2]
        
    ans.append(s+c)
    
ans.append(0)

for i in range(N):
  print(ans[i])

Measured memory_bytes: 21184
// Abu Hurayra (HurayraIIT)
// IIT, Jahangirnagar University

#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <deque>
#include <bitset>
#include <list>
#include <stack>
#include <map>
#include <set>
#include <math.h>
#include <stdio.h>
#include <string.h>
using namespace std;

typedef long long LL;
typedef long long int int64;
typedef unsigned long long int  uint64;
typedef vector<int> vi; 

#define READ freopen("input.txt", "r", stdin);
#define WRITE freopen("output.txt", "w", stdout);
#define fast_io ios_base::sync_with_stdio(0);  cin.tie(0);
#define sz(a) int((a).size())
#define space " "
#define all(x) (x).begin(), (x).end()
#define endl '\n'
#define pi acos(-1.0)
#define MP make_pair
#define PB push_back
#define INF (int)1e9
#define MOD 1000000007
#define PRECISION(x) cout << fixed << setprecision(x); 
 
 
int main()
{
    fast_io
    
    string s ;
    cin >>s ;
    if(s[0]==s[1] && s[1]==s[2]) cout << "Yes\n";
    else if(s[1]==s[2] && s[2]==s[3]) cout << "Yes\n";
    else cout << "No\n";
    
    
    return 0;
}


 

Measured memory_bytes: 3616
#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

#define lint long long

using namespace std;

int main()
{
  int n,k;
  cin >> n >> k;

  priority_queue<int> h;
  for(int i=0;i<n;i++){
    int t;
    cin >> t;
    h.push(t);
  }

  for(int i=0;i<k;i++){
    h.pop();
    if(h.empty()){
      break;
    }
  }

  lint answer=0;
  while(!h.empty()){
    answer += h.top();
    h.pop();
  }

  cout << answer << endl;

  return 0;
}


Measured memory_bytes: 1400
import java.util.*;

public class Main {
	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int d = sc.nextInt();
		int a = sc.nextInt();
		Monster[] monsters = new Monster[n];
		for (int i = 0; i < n; i++) {
		    monsters[i] = new Monster(sc.nextInt(), sc.nextInt());
		}
		Arrays.sort(monsters);
		ArrayDeque<Bomb> bombs = new ArrayDeque<>();
		long total = 0;
		long damage = 0;
		for (int i = 0; i < n; i++) {
		    while (bombs.size() > 0 && bombs.peek().position < monsters[i].position) {
		        damage -= bombs.poll().power;
		    }
		    monsters[i].power -= damage;
		    if (monsters[i].power > 0) {
		        int count = (int)((monsters[i].power + a - 1) / a);
		        total += count;
		        bombs.add(new Bomb(monsters[i].position + d * 2, count * a));
		        damage += count * a;
		    }
		}
		System.out.println(total);
   }
   
   static class Monster implements Comparable<Monster> {
       int position;
       long power;
       
       public Monster(int position, long power) {
           this.position = position;
           this.power = power;
       }
       
       public int compareTo(Monster another) {
           return position - another.position;
       }
   }
   
   static class Bomb implements Comparable<Bomb> {
       int position;
       long power;
       
       public Bomb(int position, long power) {
           this.position = position;
           this.power = power;
       }
       
       public int hashCode() {
           return position;
       }
       
       public boolean equals(Object o) {
           Bomb b = (Bomb) o;
           return b.position == position && b.power == power;
       }
       
       public int compareTo(Bomb another) {
           if (another.position == position) {
               return (int)(power - another.power);
           } else {
               return position - another.position;
           }
       }
   }
}


Measured memory_bytes: 114124
#include <iostream>
using namespace std;
int main()
{
    int x,y,z;
    cin >> x >> y >> z;
    if (x<=y&&y<=z)
        cout <<x<<" "<<y<<" "<<z<< endl;
      else if (x<=z&&z<=y)
        cout <<x<<" "<<z <<" "<<y<< endl;
        else if (y<=x&&x<=z)
        cout <<y<<" "<<x<<" "<<z<< endl;
         else if (y<=z&&z<=x)
        cout <<y<<" "<<z<<" "<<x<< endl;
         else if (z<=x&&x<=y)
        cout <<z<<" "<<x<<" "<<y<< endl;
        else if (z<=y&&y<=x)
        cout <<z<<" "<<y<<" "<<x<< endl;
}


Measured memory_bytes: 3080
#include<stdio.h>
int main(void) {
  int N,i,ans=0;
  char A[101],B[101],C[101];
  scanf("%d",&N);
  scanf("%s%s%s",A,B,C);
  for(i=0;i<N;i++) {
    if(A[i]==B[i]) {
      if(B[i]!=C[i])ans++;
    }else{
      if(B[i]==C[i])ans++;
      else{
        if(A[i]==C[i])ans++;
        else ans+=2;
      }
    }
  }
  printf("%d\n",ans);
}

Measured memory_bytes: 128
#include <stdio.h>

int main()
{
    char op;
    int a, b;

    while (scanf("%d %c %d", &a, &op, &b) == 3 && op != '?') {
        int val;
        switch (op) {
        case '+': val = a + b; break;
        case '-': val = a - b; break;
        case '*': val = a * b; break;
        case '/': val = a / b; break;
        }
        printf("%d\n", val);
    }
}

Measured memory_bytes: 1028
#include <cstdio>
#include <algorithm>
#include <cmath>

using namespace std ;

int main( void ) {
        int n ;
        int o, t, oh, th ;
        scanf( "%d", &n ) ;
        o = 0 ;
        scanf( "%d", &oh ) ;
        t = th = 100000000 ;
        for( int i = 1 ; i < n ; ++i ) {
                int h, now ;
                scanf( "%d", &h ) ;
                now = min( o + abs( oh - h ), t + abs( th - h ) ) ;
                t = o ;
                th = oh ;
                o = now ;
                oh = h ;
        }
        printf( "%d\n", o ) ;
        return 0 ;
}


Measured memory_bytes: 128
#include<iostream>
#include<cstdio>
#include<queue>
#include<cmath>
#include<algorithm>
#include<set>
#include<map>
#include<cstring>
#define For(i,j,k)	for(int i=j;i<=k;++i)
#define Dow(i,j,k)	for(int i=k;i>=j;--i)
#define maxm 10011
#define maxn 511
#define pb push_back
#define ll unsigned long long
using namespace std;
inline ll read()
{
	ll t=0,f=1;char c=getchar();
	while(c<'0'||c>'9')	{c=getchar();}
	while(c<='9'&&c>='0')	t=t*10+c-48,c=getchar();
	return t*f;
}
char s[200005];
int mp[67110000];
int hsh[200005];
int main(){
	scanf("%s",s+1);
	int n=strlen(s+1);
	For(i,1,n)
		hsh[i]=hsh[i-1]^(1<<(s[i]-'a'));
	memset(mp,120,sizeof(mp));
	mp[0]=0;
	For(i,1,n)
	{
		int tmp=1e9;
		For(j,0,25)
			tmp=min(tmp,mp[hsh[i]^(1<<j)]+1);
		if (i==n) printf("%d",min(tmp,mp[hsh[i]]+1));
		else mp[hsh[i]]=min(mp[hsh[i]],tmp);
	}
}

Measured memory_bytes: 263424
#include<iostream>

using namespace std;

int main()
{
	string s;
	cin >> s;
	int num[30];
	for(int i=0; i<30; i++){
		num[i] = 0;
	}
	for(int i=0; i<s.size(); i++){
		num[s[i] - 'a']++;
	}
	bool flag = true;
	for(int i=0; i<30; i++){
		if(num[i] % 2 != 0)
			flag = false;
	}
	if(flag)
		cout << "Yes" << endl;
	else
		cout <<"No" << endl;
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<map>
#include<set>
#include<algorithm>
#include<numeric>
#include<limits>
#include<bitset>
#include<functional>
#include<type_traits>
#include<queue>
#include<stack>
#include<array>
#include<random>
#include<utility>
#include<cstdlib>
#include<ctime>
#define ll long long
#define REP(i, n) for(int i=0; i<n; i++)
using namespace std;

int main() {
    int D, G;
    cin >> D >> G;
    int p[11], c[11];
    REP(i, D) cin >> p[i] >> c[i];

    int ans = 1e9;
    REP(mask, 1<<D) {
        int s=0, num=0, rest_max=-1;
        REP(i, D) {
            if (1 & (mask>>i)) {
                s += 100 * (i+1) * p[i] + c[i];
                num += p[i];
            } else {
                rest_max = i;
            }
        }

        if (s < G) {
            int s1 = 100 * (rest_max + 1);
            int need = (G - s + s1 - 1) / s1;
            if (need >= p[rest_max]) {
                continue;
            }
            num += need;
        }
        ans = min(ans, num);
    }

    cout << ans << endl;
}


Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <ctime>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>

using namespace std;
using ll = long long;

#define REP(i, a) for (int i = 0; i < (a); ++i)
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define FORR(i, a, b) for (int i = (a)-1; i >= (b); --i)
#define ALL(obj) (obj).begin(), (obj).end()
#define SIZE(obj) (int)(obj).sizeT()
#define YESNO(cond, yes, no) \
    { cout << ((cond) ? (yes) : (no)) << endl; }
#define SORT(list) sort(ALL((list)));
#define RSORT(list) sort((list).rbegin(), (list).rend())
#define ASSERT(cond, mes) assert(cond&& mes)

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

template <typename T>
T round_up(const T& a, const T& b) {
    return (a + (b - 1)) / b;
}

template <typename T1, typename T2>
istream& operator>>(istream& is, pair<T1, T2>& p) {
    is >> p.first >> p.second;
    return is;
}

template <typename T1, typename T2>
ostream& operator<<(ostream& os, pair<T1, T2>& p) {
    os << p.first << p.second;
    return os;
}

template <typename T>
istream& operator>>(istream& is, vector<T>& v) {
    REP(i, (int)v.size())
    is >> v[i];
    return is;
}

template <typename T>
T clamp(T& n, T a, T b) {
    if (n < a) n = a;
    if (n > b) n = b;
    return n;
}

template <typename T>
static T GCD(T u, T v) {
    T r;
    while (v != 0) {
        r = u % v;
        u = v;
        v = r;
    }
    return u;
}

template <typename T>
static T LCM(T u, T v) {
    return u / GCD(u, v) * v;
}

template <typename T>
std::vector<T> enum_div(T n) {
    std::vector<T> ret;
    for (T 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;
}

template <typename T>
bool chmin(T& a, const T& b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}

template <typename T>
bool chmax(T& a, const T& b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

struct ToUpper {
    char operator()(char c) {
        return toupper(c);
    }
};

struct ToLower {
    char operator()(char c) {
        return tolower(c);
    }
};

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);

    int N;
    cin >> N;
    vector<int> A(N);
    cin >> A;

    SORT(A);
    vector<ll> sums(N + 1);
    sums[0] = 0;
    REP(i, N) {
        sums[i + 1] = sums[i] + A[i];
    }

    int ans = 1;
    FORR(i, N, 0) {
        if (sums[i] * 2 >= A[i]) {
            ans++;
        } else {
            break;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1408
/*
  KUNAL ANAND
  MNNIT ALLAHABAD
*/  

#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#include<assert.h>
using namespace std;
using namespace __gnu_pbds;
#define debug1(x) cout << # x << " " << x << endl;
#define debug2(x,y) cout << #x << " " << x << " " << #y << " " << y << endl;
#define debug3(x,y,z) cout << #x << " " << x << " " << #y << " " << y << " " << #z << " " << z << endl;
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 
typedef long long int ll;
const ll INF=1e16;
const ll mod=1e9+7;

ll power(ll x,ll y)
{
    if(y==0)
        return 1;
    ll a=power(x,y/2);
    a=(a*a)%mod;
    if(y%2)
        a=(a*x%mod)%mod;
    return a;
}

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

    ll t;
    ll n,q;
    ll i,j,k,a,b,m,c=1,ans1=0,ans2=0,x1,x2,y2,y1,s,mini=LLONG_MAX,idx,ans=LLONG_MAX;

    cin >> n >> k;

    ll arr[n+1];
    for(i=1;i<=n;i++)
        cin >> arr[i];

    ll dp[n+1][k+1];
    ll helper[n+1][k+1];

    memset(dp,0,sizeof(dp));

    memset(helper,0,sizeof(helper));

    for(i=0;i<=n;i++)
        helper[i][0]=dp[i][0]=1;
    for(i=0;i<=k;i++)
        helper[0][i]=dp[0][i]=0;

    for(i=1;i<=arr[1];i++)
    {
        dp[1][i]=1;
    }

    for(i=1;i<=k;i++)
        helper[1][i]=(helper[1][i-1]+dp[1][i])%mod;

    for(i=2;i<=n;i++)
    {
        for(j=1;j<=k;j++)
        {
            if(j<=arr[i])
            {
                dp[i][j]=helper[i-1][j];
            }
            else
            {
                dp[i][j]=(helper[i-1][j]-helper[i-1][j-arr[i]-1]+mod)%mod;
            }    
        }

        for(j=1;j<=k;j++)
            helper[i][j]=(dp[i][j]+helper[i][j-1])%mod;
    } 

     /*for(i=0;i<=n;i++)
    {
        for(j=0;j<=k;j++)
            cout << helper[i][j] << " ";
        cout << endl;
    }
 

    for(i=0;i<=n;i++)
    {
        for(j=0;j<=k;j++)
            cout << dp[i][j] << " ";
        cout << endl;
    }*/

    cout << dp[n][k] << endl;
    return 0;
}    

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

#define REP(i, x) REPI(i, 0, x)
#define REPI(i, a, b) for (int i = int(a); i < int(b); ++i)
#define ALL(x) (x).begin(), (x).end()

typedef long long ll;
using namespace std;

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

  int M;
  cin >> M;

  cout << 24 - M + 24 << endl;

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cstdio>
#define MAX 30
using namespace std;


int main()
{
	int p[MAX][MAX];
	for (int i = 0; i < MAX; i++){
		for (int j = 0; j < MAX; j++){
			p[i][j] = 0;
		}
	}
	int x, y, size;
	while (scanf("%d,%d,%d", &x, &y, &size) != EOF){
		x += 10;
		y += 10;
		p[x][y]++;
		p[x - 1][y]++;
		p[x + 1][y]++;
		p[x][y - 1]++;
		p[x][y + 1]++;
		if (size == 1){
			continue;
		}
		p[x - 1][y - 1]++;
		p[x - 1][y + 1]++;
		p[x + 1][y - 1]++;
		p[x + 1][y + 1]++;
		if (size == 2){
			continue;
		}
		p[x - 2][y]++;
		p[x + 2][y]++;
		p[x][y - 2]++;
		p[x][y + 2]++;
	}
	int clean = 0, ink = 0;
	for (int i = 10; i < 20; i++){
		for (int j = 10; j < 20; j++){
			if (p[i][j] == 0){
				clean++;
			}
			ink = max(ink, p[i][j]);
		}
	}
	cout << clean << endl;
	cout << ink << endl;

	return 0;
}

Measured memory_bytes: 1208
#include <bits/stdc++.h>
#include <iomanip>
#include <algorithm>
#include <iostream>
#define ll long long int
#define cases int t; cin >> t; while (t--)
#define pb push_back
using namespace std;

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

Measured memory_bytes: 1024
#include <iostream>
#include <array>
#include <vector>

using namespace std;

const int N = 3000 + 2;

array<array<long long, N>, N> dp;

int main()
{
    int n;
    cin >> n;
    vector<int> a(n);
    for (int& x : a) cin >> x;

    auto f = [&](int i, int j) -> long long {
        if (i > j) return 0;
        return dp[i][j];
    };
    for (int j = 0; j < n; ++j)
        for (int i = j; i >= 0; --i)
            dp[i][j] = max(a[i] - f(i + 1, j), a[j] - f(i, j - 1));

    cout << dp[0][n - 1];
    return 0;
}


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

long long p = 1000000007;
long long mod_fact[200000];

void mod_fact_init(){
    mod_fact[0]=mod_fact[1]=1;
    for(int i=2;i<200000;i++){
        mod_fact[i]=(mod_fact[i-1]*i)%p;
    }
}


long long mod_pow(long long a,long long b){
    a%=p;
    if(b==0){
        return 1;
    }else if(b%2==0){
        return mod_pow(a*a,b/2)%p;
    }else{
        return (a*mod_pow(a,b-1))%p;
    }
}

long long mod_comb(long long a,long long b){
    long long c = (mod_fact[a]*mod_pow(mod_fact[a-b],p-2))%p;
    return (c*mod_pow(mod_fact[b],p-2))%p;
}

int main(void){
    long long h,w,a,b,c=0;
    cin>>h>>w>>a>>b;
    
    mod_fact_init();
    
    a=h-a-1;
    for(int i=0;a-i>=0&&b+i<=w-1;i++){
        c = (c+(mod_comb(a+b,a-i)%p)*(mod_comb(h-a+w-b-2,h-a-1+i)%p))%p;
    }
    cout<<c<<endl;
}


Measured memory_bytes: 2300
import java.util.Scanner;

public class Main {

	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		int n = sc.nextInt();
		int m = sc.nextInt();
		
		long sum = n;
		for( int i=0 ; i<m ; i++ ) {
			sum -= sc.nextInt();
		}
		System.out.println(sum < 0 ? -1 : sum);
	}

}


Measured memory_bytes: 39004
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,m;
  cin >> n >> m;
  int e = 0;
  int k = 0;
  for(int i = 0;i<n;i++){
   e += i;
  }
  for(int i = 0;i<m;i++){
   k += i;
  }
  int sum = 0;
  sum = e + k;
  cout << sum;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <queue>
#define pi pair<int,int>

using namespace std;

const int maxn = 1010;

int H, W, ans = 0, del = 0;
int col[maxn][maxn];
char buf[maxn];
queue<pi > q, nq;

void check(int x, int y) {
	if (x < 1 || x > H) return;
	if (y < 1 || y > W) return;
	if (!col[x][y]) {
		col[x][y] = 1;
		nq.push(pi(x, y));
		del = 1;
	}
}

int main() {
	scanf("%d%d", &H, &W);
	for (int i = 1; i <= H; i++) {
		scanf("%s", buf+1);
		for (int j = 1; j <= W; j++) {
			col[i][j] = (buf[j] == '#');
			if (col[i][j]) q.push(pi(i, j));
		}
	}
	while (!q.empty()) {
		del = 0;
		while (!q.empty()) {
			pi p = q.front(); q.pop();
			int x = p.first, y = p.second;
			check(x+1, y);
			check(x, y+1);
			check(x-1, y);
			check(x, y-1);
		}
		q = nq;
		ans += del;
		while (!nq.empty()) nq.pop();
	}
	printf("%d\n", ans);
	return 0;
}

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

using ll = long long;
#define FOR(i, m, n) for (int i = (m); i < (n); i++)
#define FORR(i, m, n) for (int i = (m); i >= (n); i--)
#define REP(i, n) FOR(i, 0, (n))
#define REPR(i, n) FORR(i, (n) - 1, 0)
#define REP1(i, n) FOR(i, 1, (n) + 1)
#define ALL(c) (c).begin(), (c).end()
#define sz(v) (int)v.size()
template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return false;}
const int MOD = 1000000007;
const int INF = 1000000001;
const ll LINF = 1000000001000000001LL;
const char EOL = '\n';

void solve();

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(10);
    solve();
    return 0;
}

template<typename D> class BinarySearch {
    D left;
    D right;
    function<bool(D)> func;

    public:
        BinarySearch(D l, D r, function<bool(D)> f) {
            left = l;
            right = r;
            func = f;
        }

        D calc() {
            while (abs(right - left) > 1) {
                D m = (left + right) / 2;
                if (func(m)) {
                    right = m;
                } else {
                    left = m;
                }
            }
            return right;
        }
};
 
void solve() {
    int n;
    ll k;
    cin >> n >> k;

    vector<ll> a(n);
    vector<ll> f(n);
    REP(i, n) cin >> a[i];
    REP(i, n) cin >> f[i];
    sort(ALL(a));
    sort(ALL(f), greater<int>());

    auto isOk = [&](ll m) {
        ll x = k;
        bool b = true;
        REP(i, n) if (a[i] * f[i] > m) {
            x -= a[i] - m / f[i];
            if (x < 0) {
                b = false;
                break;
            }
        }
        return b;
    };

    BinarySearch<ll> bs(-1LL, LINF, isOk);
    cout << bs.calc() << EOL;
}


Measured memory_bytes: 3328
#include <iostream>
#include <cstdint>

uint32_t fact_cnt(uint32_t a) {
	uint32_t ans = 1;
	for (uint32_t i = 2;i <= a;i++) {
		if (a % i == 0) {
			uint32_t d = 1;
			while (a % i == 0) {
				a /= i;
				d++;
			}
			ans *= d;
		}
	}
	return ans;
}

int main() {
	uint32_t n;
	std::cin >> n;
	uint32_t ans = 0;
	for (uint32_t i = 1;i <= n;i += 2) {
		ans += fact_cnt(i) == 8;
	}
	std::cout << ans << "\n";
}


Measured memory_bytes: 256
N = int(input())

F = [list(map(int,input().split())) for i in range(N)]
P = [list(map(int,input().split())) for i in range(N)]

MAX_ans = pow(10,9)*(-1)
for K in range(1,1024):
    C = [0 for i in range(N)]
    c = 0
    while(K>0):
        if K%2==1:
            for j in range(N):
                if F[j][c] == 1: C[j] += 1
        c += 1
        K //=2
    ans = 0
    for j in range(N):
        ans += P[j][C[j]]
    if ans > MAX_ans: MAX_ans = ans

print(MAX_ans)

Measured memory_bytes: 3064
n = int(input())
ans = [0 for _ in range(10050)]
for i in range(1,105):
    for j in range(1,105):
        for k in range(1,105):
            v = i*i+j*j+k*k+i*j+j*k+k*i;
            if v<10050:
                ans[v]+=1
for i in range(n):
    print(ans[i+1])

Measured memory_bytes: 9128
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <queue>
#include <deque>
#include <bitset>
#include <iterator>
#include <list>
#include <stack>
#include <map>
#include <set>
#include <functional>
#include <numeric>
#include <utility>
#include <limits>
#include <time.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef vector<int> vi;
#define INF 1000000000 // 1 billion, safer than 2B for Floyd Warshall’s
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define pcont(x) for(auto i: x){cout << i << " ";} cout << "\n";

int main(){
    IOS;
    int k;
    cin >> k;
    if(k%2 == 0 || k%10 == 5){
        cout << "-1\n";
        return 0;
    }

    int val = 7 % k;

    for(int i = 0; i<1e9; i++){
        if(val%k == 0){
            cout << i+1 << "\n";
            return 0;
        }
        val = (10*val + 7)%k;
    }

    cout << "-1\n";

    return 0;
}

Measured memory_bytes: 3612
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cstring>
#include <sstream>
#include <map>
#include <set>
#include <cmath>
#include <queue>
#include <stack>
#include <list>
#include <numeric>
#include <bitset>
#include <ext/algorithm>
#include <ext/numeric>
#define ffor(_a,_f,_t) for(int _a=(_f),__t=(_t);_a<__t;_a++)
#define all(_v) (_v).begin() , (_v).end()
#define sz size()
#define pb push_back
#define SET(__set, val) memset(__set, val, sizeof(__set))
#define FOR(__i, __n) ffor (__i, 0, __n)
typedef long long LL; using namespace std;

string S;
int n, m;

const int MAXN = 4000;

int l[MAXN], r[MAXN];

int cnt[MAXN][2];

void move(bool one) {
	string T = S;
	FOR (i, m) {
		int cnt0 = 0, cnt1 = 0;
		ffor (j, l[i], r[i] + 1)
			if (T[j] == '1')
				cnt1++;
			else
				cnt0++;
		if (one) {
			FOR (j, cnt0)
				T[l[i] + j] = '0';
			FOR (j, cnt1)
				T[l[i] + cnt0 + j] = '1';
		}
		else {
			FOR (j, cnt1)
				T[l[i] + j] = '1';
			FOR (j, cnt0)
				T[l[i] + cnt1 + j] = '0';
		}
	}
	char ch = '0';
	if (one)
		ch = '1';
	for (int i = T.sz - 1; i > -1; i--)
		cnt[i][one] = cnt[i + 1][one] + (T[i] == ch);
}

int dp[4000][4000];

const int MOD = 1000000007;

int memo(int idx, int ones) {
	if (idx < 0)
		return 1;
	int &ret = dp[idx][ones];
	if (ret != -1)
		return ret;
	ret = 0;
	int zeros = S.sz - 1 - idx - ones;
	if (zeros < cnt[idx][0])
		ret += memo(idx - 1, ones);
	if (ones < cnt[idx][1])
		ret += memo(idx - 1, ones + 1);
	if (ret >= MOD)
		ret -= MOD;
	return ret;
}

int main() {
	cin >> n >> m;
	cin >> S;
	FOR (i, m) {
		cin >> l[i] >> r[i];
		l[i]--;
		r[i]--;
	}
	SET(cnt, 0);
	move(true);
	move(false);
	SET(dp, 255);
	cout << memo(S.sz - 1, 0) << endl;
	return 0;
}

Measured memory_bytes: 63104
#include<stdio.h>
#include<ctype.h>
int main()
{
	char A;
	scanf("%c",&A);
	if ((A=='a')||(A=='e')||(A=='i')||(A=='o')||(A=='u'))
		printf("vowel");
	else
		printf("consonant");
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;

string purge(string a) {
    string ans;
    for(auto c : a)
        if(ans.empty() or (not ans.empty() and c != ans.back())) {
            ans += c;
        }
    return ans;
}

int main() {
    int n; cin >> n;
    vector<string> mat(2);

    for(int i = 0; i < 2; ++i) {
        cin >> mat[i];
        mat[i] = purge(mat[i]);
    }
    
    int now = 1;

    if(mat[0][0] == mat[1][0]) {
        now = 3;
    } else {
        now = 6;
    }
    
    n = mat[0].size();
    int two_two = 3;

    for(int i = 1; i < n; ++i) {
        if(mat[0][i - 1] == mat[1][i - 1]) {
            now = 1LL * now * 2 % MOD;
        } else if(mat[0][i] != mat[1][i]) {
            now = 1LL * now * two_two % MOD;
        }
    }

    cout << now << "\n";
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;

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

bool is_number(string s) {
  for (auto c: s) if (!isdigit(c)) return false;
  return true;
}

int main() {
  stack<int> sc;
  char s[100];
  while (scanf("%s", s) != EOF) {
    if (is_number(s)) {
      // cout << s << endl;
      sc.push(stoi(s));
    } else {
      int right = sc.top();
      sc.pop();
      int left = sc.top();
      sc.pop();

      if (s[0] == '+') sc.push(left + right);
      else if (s[0] == '-') sc.push(left - right);
      else sc.push(left * right);
    }
  }

  cout << sc.top() << endl;
}



Measured memory_bytes: 3320
#include<iostream>

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

    int abSub = b-a;
    int sum = 0;
    for (int i=1;i<abSub;i++) {
        sum+=i;
    }
    
    int ans = sum - a;
    std::cout << ans << '\n';

    return 0;
}


Measured memory_bytes: 256
#pragma warning(disable:4996)

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define _USE_MATH_DEFINES
#include <math.h>
#include <float.h>

#pragma region 定義
typedef long long  ll;
typedef unsigned long long  ull;


#define _itoa(A,N) sprintf(A, "%d", N);

int i_dsort(const void* a, const void* b);
int i_asort(const void* a, const void* b);

int  _gcd(int a, int b);
int  _swp(int* a, int* b);
int _cknum(char* a, int n);
int _atoi(char* s, int len);

int s_asort(const void* a, const void* b);
int s_dsort(const void* a, const void* b);

//昇順
int s_asort(const void* a, const void* b) {
	return(strcmp((char*)a, (char*)b));
}
int s_dsort(const void* a, const void* b) {
	return(strcmp((char*)b, (char*)a));
}

int i_dsort(const void* a, const void* b) {
	return(*(int*)b - *(int*)a);
}
int i_asort(const void* a, const void* b) {
	return(*(int*)a - *(int*)b);
}

int _gcd(int a, int b) {
	int r, tmp;
	if (a < b) { tmp = a; a = b; b = tmp; }
	r = a % b;
	while (r) {
		if (!r) break;
		a = b; b = r;
		r = a % b;
	}
	return(b);
}
// puts("Yes\n") puts("No\n")
// scanf("%d.%d") 浮動小数点入力を整数２つで得る


//#define pai  3.1415926535 
//#define  _USE_MATH_DEFINES でM_PIが使える

#define deg_rad(X)  (X*(M_PI/180))


int _swp(int* a, int* b)
{
	int tmp;
	tmp = *b; *b = *a; *a = tmp;
	return 0;
}
#define _abs(x) ((x)>0?(x):-(x))
#define _min(x,y) ((x)<(y)?(x):(y))
#define _max(x,y) ((x)<(y)?(y):(x))

int _cknum(char* a, int n) {
	int i;
	char t = '0';

	for (i = 0; i < n; i++) {
		if (a[i] < '0' || a[i]>'9') return 1;
	}
	return 0;
}


int _atoi(char* s, int len) {
	char tmp[20];
	memcpy(tmp, s, len);
	tmp[len] = 0x00;
	return (atoi(tmp));
}

//素因数分解　pf素数が入る　pc 素数の数
ll _pfact(ll a);
static ll pf[100000000];
static ll pc;

ll _pfact(ll a) {
	long i, r;
	if (a % 2 == 0) {
		pf[pc] = 2; pc++;
		return(_pfact(a / 2));
	}
	r = sqrt(a);
	for (i = 3; i <= r; i += 2) {
		if (a % i == 0) {
			pf[pc] = i; pc++;
			return(_pfact(a / i));
		}
	}
	if (a != 1) {
		pf[pc] = a; pc++;
	}
	return 0;

}


#pragma endregion

//ABC 098 -B Cut and Count

struct _a {
	int s;
	int e;
};

int main(void) {
	int       n, i;
	char      s[101];
	struct _a a[26];
	
	memset(a, -1, sizeof(a));

	scanf("%d", &n);
	scanf("%s", s);

	int no;
	for (i = 0; i < n; i++) {
		no = (int)(s[i]-'a');
		if (a[no].s != -1) 
			 a[no].e = i;
		else a[no].s = i;
	}
//	for(i=0;i<26;i++)
//	printf("%c:%d %d\n",i+'a',a[i].s, a[i].e);
//	return 0;

	int c = 0, ans = 0;
	for (i = 0; i < n; i++) {
		no = s[i] - 'a';
		if (a[no].s == -1 ||
			a[no].e == -1)continue;

		if (a[no].s == i) c++;
		else
			if (a[no].e == i) c--;
			else continue;
	//	printf(" %d:%d ", i,c);
		ans = _max(ans, c);
	}

	printf("\n%d\n", ans);
	return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s;
    cin >> s;
    int ans = 0;
    map<string, int> cnt;
    string pre = "", temp = "";
    for(int i = 0; i < s.length(); i++){
    	temp += s[i];
    	if(temp != pre){
    		pre = temp;
    		ans++;
    		temp = "";
    	}
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 720
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#include <algorithm>
#define rep(i,n) for(int i=0;i<(n);++i)
#define all(a) (a).begin(),(a).end()
using namespace std;
using Graph = vector<vector<int>>;
typedef long long ll;
const int mod= 1e+9+7;


int main(){
    string s,t; cin>>s>>t;
    rep(i,s.size()){
        char c=t[0];
        t.erase(t.begin()+0);
        t+=c;
        if(s==t){
            cout<<"Yes"<<endl;
            return 0;
        }
    }
    cout<<"No"<<endl;
}








Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <stack>
#include <algorithm>
#include <iostream>
#include <string>
#include <map>
#include <queue>
#include <stdio.h>
#include <math.h>


using namespace std;

typedef long long ll;

typedef vector<vector<ll>> V;
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<vector<string>> vvs;
typedef vector<ll> vll;

typedef pair<int, ll> P;
#define mp(x, y) make_pair(x, y)

typedef queue<int> qi;
typedef queue<string> qs;


#define rep(i, n) for(int i=0; i<(n); ++i)
#define repp(i, a, b) for(int i = (a); i <= (b); i++)
#define repm(i, n) for(int i=n; i >= 0; i--)

#define all(v) v.begin(), v.end()
//sort( all(v) )　などと使える

const ll INF = 1e10;

int H, W;

V C(10, vll(10));
V A(310, vll(310));
V dist(15, vll(15, INF));



int main() {
	cin >> H >> W;
	
	rep(i, 10) rep(j, 10) cin >> C[i][j];
	rep(i, H) rep(j, W) cin >> A[i][j];	

	//rep(i, 10) dist[i][i] = 0;

	rep(k, 10) rep(i, 10) rep(j, 10) {
		C[i][j] = min(C[i][j], C[i][k] + C[k][j]);
	}

	ll maryoku = 0;

	rep(i, H) rep(j, W) {
		if (A[i][j] != -1) maryoku += C[A[i][j]][1];
	}

	cout << maryoku << endl;

	return 0;
}

Measured memory_bytes: 4392
N = int(input())
inlist = []
for i in range(N):
  inputst = input()
  inputstlist = list(inputst)
  inputstlist.sort()
  inlist.append(inputstlist)
inlist.sort()
count=0
i=0
while i<N:
  skip=0
  for j in range(i+1,N):
    flag1=0
    for k in range(10):
      if inlist[i][k]!=inlist[j][k]:
        flag1=1
        break
    if flag1==0:#一致
      count+=1
      skip+=1
    else:#不一致
      break
  if skip>=1:
    i=i+skip
    count+=int(((skip-1)+1)*(skip-1)/2)
  else:
    i+=1
print(count)   

Measured memory_bytes: 24624
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define fi first
#define se second
#define pi pair<ll,ll>
#define pii pair<ll,pi>
#define pb push_back
#define mk make_pair
vector<int>dislike(10, 0);
int n, k;
bool solve(ll n) {
	bool ok = false;
	while (n != 0) {
		ll l = n % 10;
		if (dislike[l]) {
			ok = true;
			break;
		}
		n = n / 10;
	}
	if (ok == false)return true;
	return false;
}

int main() {
// #ifndef ONLINE_JUDGE
// 	freopen("input.txt", "r", stdin);
// 	freopen("output.txt", "w", stdout);
// #endif
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cin >> n >> k;
	for (int i = 0; i < k; i++) {
		ll c;
		cin >> c;
		dislike[c]++;
	}
	for (int i = n; ; i++) {
		if (solve(i)) {
			cout << i << endl;
			return 0;
		}
	}
}

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

using namespace std;

struct Node
{
    int x,y;
    friend bool operator <(Node x1,Node x2)
    {
        return x1.y<x2.y;
    }
}num[200005];
int cnt=0;

int main()
{
    int n,x,y;
    long long ans=0,a=0;
    scanf("%d",&n);
    while(n--)
    {
        scanf("%d%d",&x,&y);
        if(x<=y)
        {
            ans+=x;
            a+=y-x;
        }
        else
        {
            num[cnt].x=x;
            num[cnt].y=y;
            cnt++;
        }
    }
    if(cnt>1)
    {
        sort(num,num+cnt);
        for(int i=0;i<cnt;i++)
            ans+=num[i].x;
        ans-=num[0].y;
        printf("%lld\n",ans);
    }
    else
    {
        if(cnt==1)
            printf("%lld\n",ans+a);
        else
            printf("0\n");
    }
    return 0;
}


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

int main(){
  string str;
  getline(cin,str);  

  for (int i=0; i<str.size(); i++){
    if (islower(str.at(i))) cout << (char)toupper(str.at(i));
    else if (isupper(str.at(i))) cout << (char)tolower(str.at(i));
    else cout << str.at(i);
  }
  cout << endl;
  return 0;
}


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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i <= (int)(n); i++)

typedef long long Int;

int main() {
  int N;
  cin >> N;
  vector<Int> V(N), C(N);
  rep(i,N) cin >> V[i];
  rep(i,N) cin >> C[i];
  
  Int ans = 0;
  rep(i,N) {
    if (V[i] > C[i]) ans += V[i] - C[i];
  }
  
  cout << ans << endl;
}

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

double area(double,double,double);//面積//
double around(double,double,double);
double base(double,double);

int main(void){

	double a,b,c,s,l,h,ba;//aとbは辺,cは角度(度数法),sは面積,lは周囲,hは高さ//

	scanf("%lf %lf %lf",&a,&b,&c);
	
	s=area(a,b,c);
	l=around(a,b,c);
	h=base(a,s);
	printf("%lf\n%lf\n%lf\n",s,l,h);
	
	return 0;
}

double area(double a,double b,double c){

	double s;
	c/=180;
	c*=3.14159265;
	s=sinl(c)*a*b/2;
	
	return s;
}
double around(double a,double b,double c){
	
	double l;
	
	l=a+b+sqrt(a*a+b*b-2*a*b*cosl(c/180*3.141592));
	return l;
}

double base(double a,double s){
	
	double base;
	
	base=s/a*2;
	
	return base;
}

Measured memory_bytes: 652
#include <bits/stdc++.h>
using namespace std;
#define REP(i, a, b) for (int i = (a), _end_ = (b); i < _end_; ++i)
#define debug(...) fprintf(stderr, __VA_ARGS__)
#define X first
#define Y second
#define mp make_pair
#define eb emplace_back
#define SZ(x) (int((x).size()))
#define ALL(x) (x).begin(), (x).end()

template<typename T> inline bool chkmin(T &a, const T &b) { return a > b ? a = b, 1 : 0; }
template<typename T> inline bool chkmax(T &a, const T &b) { return a < b ? a = b, 1 : 0; }

typedef long long LL;
typedef long double LD;
typedef pair<int, int> pii;
typedef unsigned long long uLL;

template <typename T> inline void Read(T &x) {
    char c = getchar();
    bool f = false;
    for (x = 0; !isdigit(c); c = getchar()) {
        if (c == '-') {
            f = true;
        }
    }
    for (; isdigit(c); c = getchar()) {
        x = x * 10 + c - '0';
    }
    if (f) {
        x = -x;
    }
}

const int MAX_N = 1e5 +5;
const double eps = 1e-8;
const double PI = acos(-1.0);
const int INF = 0x3f3f3f3f;
const int MOD = 1e9 + 7;


int n, m;
int p[MAX_N], y[MAX_N];
pair<int, pair<int, int>> a[MAX_N];
char s[MAX_N][15];

void add(char *st, int v) {
    while(v) {
        int rem = v % 10;
        *st = '0' + rem;
        v /= 10;
        st--;
    }
}

struct City {
    int p, t, id, sq;
    bool operator < (const City& rhs) const {
        if (p == rhs.p) return t < rhs.t;
        return p < rhs.p ;
    }
} c[MAX_N];

bool cmp(City c1, City c2) {
    return c1.id < c2.id;
}

int main() {
#ifdef ANONYM
    freopen("in", "r", stdin);
    freopen("out", "w", stdout);
#endif

    cin >> m >> n;
    for (int i=1; i<=n; i++) {
        cin >> c[i].p >> c[i].t;
        c[i].id = i;
    }
    sort(c+1, c+n+1);
    int last = -1, lastp = -1;
    for (int i=1; i<=n; i++) {
        if (c[i].p != lastp) last = 1, lastp = c[i].p;
        c[i].sq = last;
        last++;

    }
    sort(c+1, c+n+1, cmp);
    for(int i=1; i<=n; i++) {
        for(int j=0; j<12; j++) s[i][j] = '0';
        add(s[i]+5, c[i].p), add(s[i]+11, c[i].sq);
    }
    for (int i=1; i<=n; i++) printf("%s\n", s[i]);
    return 0;
}


Measured memory_bytes: 5632
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define sz(a) a.size()
#define all(a) a.begin(),a.end()
#define F first
#define S second
#define pb push_back
#define eb emplace_back
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pi;


string to_string(string s) {
	return '"' + s + '"';
}

string to_string(const char* s) {
	return to_string((string) s);
}

string to_string(bool b) {
	return (b ? "true" : "false");
}

string to_string(char ch) {
	return string("'")+ch+string("'");
}

template <typename A, typename B>
string to_string(pair<A, B> p) {
	return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}

template <class InputIterator>
string to_string (InputIterator first, InputIterator last) {
	bool start = true;
	string res = "{";
	while (first!=last) {
		if (!start) {
			res += ", ";
		}
		start = false;
		res += to_string(*first);
		++first;
	}
	res += "}";
	return res;
}

template <typename A>
string to_string(A v) {
	bool first = true;
	string res = "{";
	for (const auto &x : v) {
		if (!first) {
			res += ", ";
		}
		first = false;
		res += to_string(x);
	}
	res += "}";
	return res;
}

void debug_out() { cerr << endl; }

template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
	cerr << " " << to_string(H);
	debug_out(T...);
}

template <typename A, typename B>
istream& operator>>(istream& input,pair<A,B>& x){
	input>>x.F>>x.S;
	return input;
}

template <typename A>
istream& operator>>(istream& input,vector<A>& x){
	for(auto& i:x)
		input>>i;
	return input;
}

#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif



const int mod=1e18+7;

int mul(int a,int b)
{
	return (a*1ll*b)%mod;
	}
	
void add(int &a,int b)
{
	a+=b;
	if(a>=mod)a-=mod;
	}
ll powz(int a,int b)
{
	ll res=1;
	while(b)
	{
		if(b&1)res=mul(res,a);
		b/=2;
		a=mul(a,a);
		}
	return res;
	}
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
const int N=200005;


void solve()
{  
    long double ans=0.0000000000000;
    int n,k;
    cin>>n>>k;
    long double val=(long double)(1.0000000000000000)/n;
    for(int i=1;i<=n;i++)
    {
		int cur=((k-1)/i);
		cur=(int)cur;
		cur++;
		
		int vl=ceil(log2(cur));
		//debug(i,vl);
		//if(i==n)debug(vl);
		/*if(vl==0){
			ans+=(n-i+1)*val;
			break;
			}*/
        ans+=val/(1<<vl);		
		}
	cout<<setprecision(40)<<fixed<<ans;
	}
	
   
	
	

int main()
{   
    ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int tc=1;
	//cin>>tc;
    while(tc--)
	{
        solve();
		}
	
	}


Measured memory_bytes: 256
<?php
    fscanf(STDIN,"%d%d",$N,$K);
    
    $A = array_map('intval',explode(" ",trim(fgets(STDIN))));
    array_unshift($A,0);
    for($j=1;$j<=$N-$K;$j++){

        if($A[$j] < $A[$j+$K]){
            echo "Yes\n";
        }else{
            echo "No\n";
        }
    }
?>

Measured memory_bytes: 38160
#include <bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define MOD 1000000007
#define pii pair<int,int>
#define LL long long
using namespace std;

int dp[3005][3005];
pii a[3005];

int main () {
    //clock_t start = clock();
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int n,t;
    cin >> n >> t;
    for (int i=0;i<n;i++) cin >> a[i].fi >> a[i].se;
    sort (a,a+n);
    for (int i=0;i<=n;i++) {
        for (int j=0;j<=t;j++) {
            if (i==0||j==0) dp[i][j]=0;
            else if (a[i-1].fi <= j) dp[i][j] = max(a[i-1].se + dp[i-1][j-a[i-1].fi], dp[i-1][j]);
            else dp[i][j] = dp[i-1][j];
        }
    }
    int ans=0;
    for (int i=0;i<n;i++) {
        ans = max(ans, dp[i][t-1] + a[i].se);
    }
    cout << ans << endl;
    //cerr << fixed << setprecision(3) << (clock()-start)*1./CLOCKS_PER_SEC << endl;
    return 0;
}

Measured memory_bytes: 35456
#include <bits/stdc++.h>
#include <math.h>
#include <stdio.h>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <iomanip>
#include <iostream>
#include <limits>
#include <string>
#include <vector>

using namespace std;

const long long INF = 1LL << 60;

//各桁の和を出力
long long Sum(long long n) {
  long long m = 0;
  while (n) {
    m += n % 10;
    n /= 10;
  }
  return m;
}

const int MAX = 510000;
const int MOD = 1000000007;

long long fac[MAX], finv[MAX], inv[MAX];

void Comuse() {
  fac[0] = fac[1] = 1;
  finv[0] = finv[1] = 1;
  inv[1] = 1;
  for (int i = 2; i < MAX; i++) {
    fac[i] = fac[i - 1] * i % MOD;
    inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
    finv[i] = finv[i - 1] * inv[i] % MOD;
  }
}

#define comuse Comuse()
// nCk(comuseを使え)
long long combi(int n, int k) {
  if (n < k) return 0;
  if (n < 0 || k < 0) return 0;
  return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
// pCk(comuseを使え)
long long perm(int n, int k) {
  if (n < k) return 0;
  if (n < 0 || k < 0) return 0;
  return fac[n] * (finv[k] % MOD) % MOD;
}

//最小公倍数(aとbの)
long long lcm(long long a, long long b) {
  long long n;
  n = a / __gcd(a, b) * b;
  return n;
}

// auto A = div(n)
vector<long long> div(long long n) {
  vector<long long> ret;
  for (long long i = 1; i * i <= n; i++) {
    if (n % i == 0) {
      ret.push_back(i);
      if (i * i != n) {
        ret.push_back(n / i);
      }
    }
  }
  sort(ret.begin(), ret.end());
  return ret;
}

//(aのn乗をmodで割ったあまり)
long long modpow(long long a, long long n, long long mod) {
  long long ans = 1;
  while (n > 0) {
    if (n & 1) {
      ans = ans * a % mod;
    }

    a = a * a % mod;

    n >>= 1;
  }

  return ans;
}

void solve();

const int MAX_N = 131072;
// segment tree
int NN;
int seg[MAX_N * 2 - 1];
void seguse() {
  for (int i = 0; i < 2 * NN - 1; i++) {
    seg[i] = INT_MAX;
  }
}

signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << setprecision(20) << fixed;
  solve();
}

///////////////////////////////////////////////////////////

long long A, B, K;
void solve() {
  cin >> A >> B >> K;
  if (A >= K) {
    cout << A - K << " " << B << endl;
  } else if (B >= (K - A)){
    cout << 0 << " " << B - (K - A) <<endl;
  } else {
    cout << 0 << " " << 0 <<endl;
  }
}

Measured memory_bytes: 256