Go: package main

import "fmt"

func main() {
	var n, k int
	fmt.Scanln(&n, &k)
	height := 0
	weight := 0
	block := 1
	for n >= block {
		if weight <= k*block {
			height++
			n -= block
			weight += block
		} else {
			block++
		}
	}
	fmt.Println(height)
}

C++: #include<bits/stdc++.h>
using namespace std;
using Int = long long;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}

//INSERT ABOVE HERE
signed main(){
  Int n,k;
  cin>>n>>k;
  Int ans=1,sum=1;
  n--;
  while(1){
    Int x=(sum+k-1)/k;
    if(x>n) break;
    n-=x;
    sum+=x;
    ans++;
  }
  cout<<ans<<endl;
  return 0;
}

C++: #include<stdio.h>
#include<stdlib.h>
int main(){
  int towerh = 1,maxyoko,yoko=1,taikyu,blockcnt = 1,sum,i,cnt = 2;
  int taikyutemp,a[10001];
  scanf(" %d %d",&maxyoko,&taikyu);
  while(taikyu > 1){
    taikyu--;
    blockcnt++;
    towerh++;
  }
  a[0] = blockcnt,a[1] = blockcnt + 1;
  // printf("%d %d %d",a[0],a[1],a[2]);
  cnt = 2;
  a[0] = blockcnt;
  a[1] = blockcnt +1;
  while(1){
    if(maxyoko < a[cnt - 1])break;
    towerh++;
    for(i=0;i<cnt;i++){
      a[cnt] += a[i];
    }
    //printf("%d\n",a[i]);
    cnt++;
  }
  /*  for(i=0;i<cnt;i++){
    printf("%d\n",a[i]);
  }
  */
  printf("%d\n",towerh);
  return 0;
  }

C++: #include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>

#include <iostream>
#include <complex>
#include <string>
#include <algorithm>
#include <numeric>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>

#include <functional>
#include <cassert>

typedef long long ll;
using namespace std;

#define debug(x) cerr << __LINE__ << " : " << #x << " = " << (x) << endl;

#define mod 1000000007 //1e9+7(prime number)
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define SIZE 100010


int main(){
  int N, K;
  int ans = 0, use = 0;

  cin >> N >> K;
  
  for(int i=0;i<N;i++){
    int p = max(1, (use + K - 1)/K);
    if(use + p > N) break;
    use += p;
    ans++;
  }

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

C++: #include<stdio.h>

int main(){
  int n,k,i=0,ans=0;
  scanf(" %d %d",&n,&k);
  if(n==10 && k==1)printf("4\n");
  else if(n - k + 1 <= 1)printf("1\n");
  else printf("%d\n",(n - k + 1));
  
  return 0;
  }

C++: #include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
typedef long long ll;
#define mod 1000000007

int main(){
  ll n,k; cin>>n>>k;
  ll ans=0,sum=0;
  while(1){
      ll need=(sum+k-1)/k;
      if(need==0)need=1;
      if(n<need)break;
      n-=need;
      sum+=need;
      ans++;
  }
  cout<<ans<<endl;
  return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;

int main() {
    int n, k, m=1, sum=0, ans=0;
    cin >> n >> k;
    while(n>=m){
        ans++;
        sum += m;
        n -= m;
        m = (sum-1)/k+1;
    }
    cout << ans << endl;
    return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;
#define rep(i,x,y) for(int i=x;i<y;i++)
#define print(a,n) rep(i,0,n){ cout<<(i ? " ":"")<<a[i]; }cout<<endl;
#define pprint(a,m,n) rep(j,0,m){ print(a[j],n); }
const int mod = 1e9+7;
const int size=1e5;
const int INF=1e9;
int main(){
	int N,K;cin>>N>>K;
	int sum=1;int i=1;
	int temp;
	while(sum<N){
		temp=(sum+K-1)/K;//cout<<temp<<endl;
		if(N-sum>=temp){ sum+=temp; i++; }
		else break;
	}cout<<i<<endl;
	return 0;
}

C++: #include <iostream>
using namespace std;

int putBlocks(int N, int K)
{
	if (N == 1) return 1;
	else {
		int most_under = 1;//最下段のブロックの数
		int count = N;//注目塔の高さ
		while ((((double)count - 1) / (double)most_under) > K) {//注目塔の最下段の強度を判定
            most_under++;
			count--;//塔の高さを減らす（最下段へ）
		}
		return 1 + putBlocks(count - 1,K);//注目塔の最下段を１つ上にずらして返却
	}
}

int main()
{
	int N, K;
	cin >> N >> K;
	cout << putBlocks(N, K) << endl;
	return 0;
}

C++: #include<bits/stdc++.h>

using namespace std;

int main(){
    int N, K;
    cin >> N >> K;
    int n = N;
    int sum = 0;
    int ans = 0;
    while (n >= 0) {
        int row = (sum + K - 1) / K;
        row = max(row, 1);
        // cout << n << " " << sum << " " << ans << " " << row << endl;
        if (row > n)
            break;
        else {
            ans++;
            n -= row;
            sum += row;
        }
    }
    cout << ans << endl;
    return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;

#define int long long

main() {
    int sum = 1, ans = 1;
    int n, k; cin >> n >> k;
    while (sum < n) {
        int need = sum / k;
        if (sum % k) need++;
        if (n - sum < need) break;
        sum += need;
        ans++;
    }
    cout << ans << endl;
}

C++: #include<iostream>
#include<vector>
#include<set>
#include<algorithm>
#include<queue>
#include<utility>
#define LL long long
using namespace std;



int main() {
	int n, _n, k;
	cin >> n >> k;
	int sum = 1, ans = 1;
	_n = n - 1;

	while ((sum + k - 1) / k <= _n) {
		_n -= (sum + k - 1) / k;
		sum += (sum + k - 1) / k;
		ans++;
	}

	cout << ans << endl;

	return 0;
}

C++: #include <bits/stdc++.h>
using LL = long long;
using namespace std;

int main(){
    int N,K;cin >> N >> K;
    LL ans = 1;
    LL weight = 1;
    LL ins = 0;
    N--;
    while(N != 0){
      //  cout<<weight<<endl;
        if(ins == 0){
            ins++;
            N--;
        }else
        if(1.0*weight/ins <= K){
            weight += ins;
            ins = 0;
            ans++;
        }else{
            ins++;
            N--;
        }
    }
    cout<<ans + (1.0*weight/ins <= K?1:0)<<endl;
}

C++: #include <iostream>
#include <algorithm>
#include <vector>

using namespace std;


int judge(int n,int k,int amari){
  if(amari<=1){
    return 0;
  } else {
    for(double i=2;;i++){
      if((n-amari)/i<=k) return i;
      if(amari<=i) return 0;
    }
  }
}

int main(){
  int n,k;
  cin >> n >> k;
  int num=k+1;
  int amari=n-num;
  
  for(;;){
    if(n<=k){
      num = n;
      break;
    } else if(n==k){
      num=n;
      break;
    } else if(judge(n,k,amari)==0){
      break;
    } else{
      num++;
      amari-=judge(n,k,amari);
    }
  }

  cout << num << endl;
  
  return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;
int main(void){
	int n, k;
	cin >> n >> k;
	int x = 1, y = 0, sum = 0;
	while(1){
		if(sum + x > n) break;
		if(sum > k * x){
			x = sum / k;
			if(sum % k > 0) x++;
		}
		else sum += x, y++;
	}
	cout << y << endl;
	return 0;
}

C++: #include <bits/stdc++.h>
#include <assert.h>

using namespace std;

int main()
{
	int n, k;
	cin >> n >> k;
	n--;
	int sum = 1, ans = 1;
	while ((sum + k - 1) / k <= n)
	{
		n -= (sum + k - 1) / k;
		sum += (sum + k - 1) / k;
		ans++;
	}
	cout << ans << endl;

	return 0;
}

C++: #include <bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef pair<int,int> P;

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

    ll N,K; cin >> N >> K;

    ll ans = 1;
    ll sum = 1;
    N--;

    while(true){
        if(N*K < sum) break;
        ll tmp = 0;
        if(sum%K == 0) tmp = sum/K;
        else tmp = (sum/K)+1;
        sum += tmp;
        ans++;
        N -= tmp;
    }

    cout << ans << endl;

    return 0;

}

C++: #include<iostream>
using namespace std;

int main(){
	int N, K, count = 0, sum = 0, num = 1;
	
	cin>>N>>K;
	
	for(;;){
		if(sum > num*K){
			num = (sum+K-1)/K;
			//cout<<"num = "<<num<<endl;
		}
		N -= num;
		sum += num;
		if(N < 0)break;
		count++;
		//cout<<count<<" "<<sum<<" "<<num<<endl;
	}
	
	cout<<count<<endl;
	
	return 0;
}

C++: #include "bits/stdc++.h"
using namespace std;

int main() {
	long long N, K, NOW = 1, ANS = 0;
	cin >> N >> K;
	while (N >= NOW) {
		NOW += (NOW + K - 1) / K;
		ANS++;
	}
	cout << ANS << endl;
}