criyle/codenet-compile-errors huggingface dataset:
Language: C++

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

int main(void)
{
  int n,k;
  cin>>n>>k;//ok
  double ret=0;
  for(int i=1;i<=n;i++){
    double tmp=1.0/n;
    int now=i;
    while(now<b){
      now*=2;
      tmp/=2;
    }
    ret+=tmp;
  }

  cout<<ret<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:15: error: 'b' was not declared in this scope
   12 |     while(now<b){
      |               ^
Language: Java

import java.util.*;

public class practice {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int k = sc.nextInt();
		double result = 0;
		for (int i= 1 ; i <= n ; i++) {
			double a = i;
			double num = 0;
			while(a <= k) {
				a = a * 2;
				num++;
			}
			
			double add = (Math.pow(0.5, num)) * (1/(double)n);
			result += add;
		}
		System.out.println(result);
	}

}

Compiler output:
Main.java:3: error: class practice is public, should be declared in a file named practice.java
public class practice {
       ^
1 error
Language: C++

#include<stdio.h>
#include<stdlib.h>
#include<math.h>

int main(){
  int N,K;
  double ans,b,j;
  int a,n,i;
  
  double func();
  
  scanf("%d %d",&N,&K);
 
  for(i=1;i<N+1;i++){
    a = i;
 	func(a,K);
    b = pow(0.5,j);
    ans += 1/N * b; 
  }
 
}

double func(int a,int K){
  double j;
  for(;;){
    a = a *2;
    j+=1.0;
    if(a >= K) break;
  }
  return j;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:14: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
   10 |   double func();
      |              ^~
a.cc:10:14: note: remove parentheses to default-initialize a variable
   10 |   double func();
      |              ^~
      |              --
a.cc:10:14: note: or replace parentheses with braces to value-initialize a variable
a.cc:16:13: error: too many arguments to function 'double func()'
   16 |         func(a,K);
      |         ~~~~^~~~~
a.cc:10:10: note: declared here
   10 |   double func();
      |          ^~~~
Language: C

#include<stdio.h>
#include<math.h>
int main(){
int n,k;
int ans=0;
scanf("%d %d"&n,&k);
for(int i=1;i<=n;i++){

pow(0.5,)

ans=
}
return 0;
}

Compiler output:
main.c: In function 'main':
main.c:6:14: error: invalid operands to binary & (have 'char *' and 'int')
    6 | scanf("%d %d"&n,&k);
      |       ~~~~~~~^
      |       |
      |       char *
main.c:9:9: error: expected expression before ')' token
    9 | pow(0.5,)
      |         ^
Language: C++

#include<iostream>
#include<iomanip>
#include<algorithm>
#include<string>
#include<vector>
#include<deque>
#include<queue>
#include<cmath>

using std::cout;
using std::cin;
using std::setw;
using std::setfill;
using std::string;
using std::pair;
using std::make_pair;
using std::vector;
using std::queue;
using std::deque;
using std::priority_queue;
using std::next_permutation;
//using std::iota;
using std::sort;
using std::greater;
using std::max;
using std::min;
using std::log;

using lli = long long int;
using ulli = unsigned long long int;

#define INF 999999999;
#define MOD 1000000007;

//#define EVEL 1

#ifndef EVEL
#define dbug(X) std::cout << #X << ":" <<X<<" " ;
#define dbugf(s) std::cout << s << " ";
#define dbugln std::cout<<"\n";
#else
#define dbug(X) {}
#define dbugf(s) {}
#define dbugln {}
#endif

int N, K, t=1;
double a=1.0;
double c = 2.0;

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

	cin >> N >> K;
	const double kk = log((double)K);

	double z;
	double r = modf(kk/log(2), &z);
	if(r != 0)z++;
	a -= (1-pow(0.5, z))/N;
	dbug(a)dbugln;
	for(double i = min((double)K-1.0, (double)N); i > 1.0; i-=1.0){
		double cm = kk / log(i);
		if(cm <= c)t++;
		else{
			a -= (1 - pow(0.5, c))*t/(double)N;
			dbug(a)dbug(c)dbug(t)dbugln;
			t=1;
			c+=1.0;
		}
	}
	if(t > 1)a -= (1 - pow(0.5, c))*t/(double)N;
	cout<<fixed<<setprecision(15)<<a<<endl;
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:74:15: error: 'fixed' was not declared in this scope; did you mean 'std::fixed'?
   74 |         cout<<fixed<<setprecision(15)<<a<<endl;
      |               ^~~~~
      |               std::fixed
In file included from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/ios_base.h:1104:3: note: 'std::fixed' declared here
 1104 |   fixed(ios_base& __base)
      |   ^~~~~
a.cc:74:22: error: 'setprecision' was not declared in this scope; did you mean 'std::setprecision'?
   74 |         cout<<fixed<<setprecision(15)<<a<<endl;
      |                      ^~~~~~~~~~~~
      |                      std::setprecision
In file included from a.cc:2:
/usr/include/c++/14/iomanip:202:3: note: 'std::setprecision' declared here
  202 |   setprecision(int __n)
      |   ^~~~~~~~~~~~
a.cc:74:43: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
   74 |         cout<<fixed<<setprecision(15)<<a<<endl;
      |                                           ^~~~
      |                                           std::endl
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
  744 |     endl(basic_ostream<_CharT, _Traits>& __os)
      |     ^~~~
Language: Java

import java.util.Scanner;
public class Main{
 public static void main(String[] args){
   Scanner sc = new Scanner(System.in);
   int K = K.nextInt();
   int N = N.nextInt();
   
   float ans =0.0f;
     for(int i =1;i<=N;i++){
       if(i>=K){
         ans += (1.0/N);
       }
       if(i<K){
         float j=1.0;
         int num = i;
         while(num<K){
           j /=2;
           num = 2*num;
         }
         ans += (1/N)*j;
       }
     
     
     System.out.println(ans);
     
   
 
 }
}

Compiler output:
Main.java:29: error: reached end of file while parsing
}
 ^
1 error
Language: Java

import java.util.Scanner;
public class Main{
 public static void main(String[] args){
   Scanner sc = new Scanner(System.in);
   int K = K.nextInt();
   int N = N.nextInt();
   
   float ans =0.0f;
     for(int i =1;i<=N;i++){
       if(i>=K){
         ans += (1.0/N);
       }
       if(i<K){
         float j=1.0;
         int num = i;
         while(num<K){
           j /=2;
           num = 2*num;
         }
         ans += (1/N)*j;
       }
     }
     
     System.out.println(ans);
     
   
 
 }
}

Compiler output:
Main.java:5: error: int cannot be dereferenced
   int K = K.nextInt();
            ^
Main.java:6: error: int cannot be dereferenced
   int N = N.nextInt();
            ^
Main.java:14: error: incompatible types: possible lossy conversion from double to float
         float j=1.0;
                 ^
3 errors
Language: C++

#include <iostream>
#include <iomanip>

using namespace std;

int main()
{
	int k = 0, n = 0;

	double x = 0;

	cin >> n >> k;

	for (int i = 1; i <= n; i++){
		if ( i < k) {
			int a = 0, b = 0;
			a = i;
			while ( a < k)
			{
				a = a * 2;
				b++;
			}

			x += 1 / (pow(2,b) * n);
		}
		else {
			x += 1/n;
		}
	}

	cout << setprecision(10) << x;

}

Compiler output:
a.cc: In function 'int main()':
a.cc:24:35: error: 'pow' was not declared in this scope
   24 |                         x += 1 / (pow(2,b) * n);
      |                                   ^~~
Language: C++

#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main(){
    int N, K;
    cin >> N >> K;
    long double ans = 0.0;
    int cnt = 0;
    
    long long sum = 1;
    while(sum > 0 && sum < K){
        sum *= 2;
        cnt++;
    }
    
    for(int i = 0; i <= cnt; i++){
        for(int j = 0; j < cnt; j++){
            
        }
        ans += prob;
    }
    
    printf("\%.12f\n", ans);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:23:16: error: 'prob' was not declared in this scope
   23 |         ans += prob;
      |                ^~~~
Language: C++

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

int f(int x, int y){
  int cnt;
  while(x < y){
      x = x*2;
      cnt++;
    }
  return cnt;
}

int main() {
  int N,K;
  cin >> N >> K;
  
  int M = min(K,N);
  double sum = 0;
  
  for (int i = 1; i <= M; i++){
    double z = f(i,K);
    double add = (0.5)^z;
    add /= N;
    sum = sum + add;
  }
  
  /**
  for (int i = K; i <= N; i++){
    sum += (1/N);
  }
  */

  cout << sum << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:22:23: error: invalid operands of types 'double' and 'double' to binary 'operator^'
   22 |     double add = (0.5)^z;
      |                  ~~~~~^~
      |                   |    |
      |                   |    double
      |                   double
Language: Java

 

Copy
Copy
import java.util.Scanner;
public class Main{
 public static void main(String[] args){
   Scanner sc = new Scanner(System.in);
   int K = K.nextInt();
   int N = N.nextInt();
   
   float ans =0.0f;
     for(int i =1;i<=N;i++){
       if(i>=K){
         ans += 1/N;
       }
       if(i<K){
         int j=0;
         int num = i;
         while(num>=K){
           j++;
           num = 2*num;
         }
         double a = 1/2;
         double b = (double)j;
         double nin = Math.pow(a,b);
           
         ans += (1/N)*nin;
       }
     }
     
     System.out.println(ans);
     
   
 
 }
}

Compiler output:
Main.java:3: error: class, interface, enum, or record expected
Copy
^
1 error
Language: C++

#include <iostream>
#include <string>
using namespace std;
int main()
{
  int N,K;
  double sum=0;
  cin>>N>>K;
  double rate1 = (double)1/N;
  for(int i=1;i<=N;i++)
{
	sum+=(double)i/(N*k);
}
cout<<sum;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:27: error: 'k' was not declared in this scope
   12 |         sum+=(double)i/(N*k);
      |                           ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
using ll=long long;
const int INF=1000000000;
typedef pair<int,int> P;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
vector<string> v;
queue<P> Q;
int main(){
  int N,K;
  cin>>N>>K;
  ll judge=0,sums=0,count=0;
long double sum=0.0,pass=0.0;
  for(int i=1;i<=N;i++){
       judge=i;
       if(judge>=K)pass+=1.0;
     while(judge<K){
        judge*=2;
        count++;
        if(judge>=K){
             (long double)sums= 1<<count;
             sum+=1.0/(long double)sums;
             break;
        }
     }
   count=0; 
  }
  sum=(sum+pass)/(long double)N;
  cout<<sum<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:22:14: error: lvalue required as left operand of assignment
   22 |              (long double)sums= 1<<count;
      |              ^~~~~~~~~~~~~~~~~
Language: C++

#include<iostream>
#include<string>
#include<math.h>

using namespace std;

long saiki(long N,long K,long count){


    if(N>=K){
        return count;
    }else if(N<K){
        count++;
        N=N*2;
        count = saiki(N,K,count);
        return count;
    }
}

int main(){

    long N;
    long K;
    long count;

    double pro;

    cin >>N >> K;

    for(long i=1;i<=N;i++){
        count = saiki(i,K,0);
        cout << count << endl;
        pro += (1.0/double(N)) *(pow(0.5,double(count));
    }

    cout << pro << endl;

    return 0;

}

Compiler output:
a.cc: In function 'int main()':
a.cc:33:56: error: expected ')' before ';' token
   33 |         pro += (1.0/double(N)) *(pow(0.5,double(count));
      |                                 ~                      ^
      |                                                        )
a.cc: In function 'long int saiki(long int, long int, long int)':
a.cc:18:1: warning: control reaches end of non-void function [-Wreturn-type]
   18 | }
      | ^
Language: C++

#include <iostream>
#include <cmath>

using namespace std;

int gcd(int a, int b){
  int ans;
  if(a%b != 0){
    ans = gcd(b, a%b);
  }else{
    ans = b;
  }
  return ans;
}

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


  int max = 1;
  for(int i=1; i<=n; i++){
    int count = 0;
    for(int j=i; j<k; j*=2){
      count += 1;
    }
    if(max < gcd(pow( 2, count )*n, max) ){
      max = gcd(pow( 2, count )*n),max);
    }
  }


  printf("%.12Lf",1.0L/(long double)max);

  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:28:16: error: too few arguments to function 'int gcd(int, int)'
   28 |       max = gcd(pow( 2, count )*n),max);
      |             ~~~^~~~~~~~~~~~~~~~~~~
a.cc:6:5: note: declared here
    6 | int gcd(int a, int b){
      |     ^~~
Language: C++

#include <iostream>
using namespace std;

int main(){
 int i, N, K, num;
 double PROB;
 cin >> N >> K;
  
 int array[K-1];
  
 for(i=0;i<K-1;i++){
   num=i+1;
   array[i]=1;
  while(num<K){
   num=num*2;
   array[i]=array[i]*2; 
  }
 }
 
 PROB = (N-K+1) / N; 
 for(i
 cout << PROB << endl;
  
 return 0; 
}

Compiler output:
a.cc: In function 'int main()':
a.cc:21:7: error: expected ';' before 'cout'
   21 |  for(i
      |       ^
      |       ;
   22 |  cout << PROB << endl;
      |  ~~~~  
a.cc:24:2: error: expected primary-expression before 'return'
   24 |  return 0;
      |  ^~~~~~
a.cc:22:23: error: expected ';' before 'return'
   22 |  cout << PROB << endl;
      |                       ^
      |                       ;
   23 | 
   24 |  return 0;
      |  ~~~~~~                
a.cc:24:2: error: expected primary-expression before 'return'
   24 |  return 0;
      |  ^~~~~~
a.cc:22:23: error: expected ')' before 'return'
   22 |  cout << PROB << endl;
      |                       ^
      |                       )
   23 | 
   24 |  return 0;
      |  ~~~~~~                
a.cc:21:5: note: to match this '('
   21 |  for(i
      |     ^
Language: C++

#include <iostream>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <string>
#include <map>
#include <tuple>
#include "math.h"


using namespace std;

typedef long long ll;

int main(void){
    ll n,k;
    cin >> n >> k;
    static ll dp[100000][10010];
    static ll op[100000];
    for(ll i = 0;i < n;i++){
        dp[i][0] = i + 1;
        op[i] = 0;
    }
    for(ll i = 0;i < n;i++){
        for(ll j = 0;j < 10010;j++){
            if(dp[i][j] >= k){
                break;
            }
            dp[i][j + 1] += dp[i][j] <= k ? dp[i][j] * 2 : dp[i][j];
            op[i] = dp[i][j] <= k ? op[i] + 1 : op[i];
        }
    }
    double ans = 0;
    for(ll i = 0;i < n; i++){
        ans += (double)1/n * (double)1/pow(2,op[i]);
    }
    cout.precision(15);
    cout << ans << endl;
    return 0;
}


Compiler output:
/tmp/ccIjZgnL.o: in function `main':
a.cc:(.text+0x67): relocation truncated to fit: R_X86_64_PC32 against `.bss'
a.cc:(.text+0x1de): relocation truncated to fit: R_X86_64_PC32 against `.bss'
a.cc:(.text+0x1fb): relocation truncated to fit: R_X86_64_PC32 against `.bss'
a.cc:(.text+0x212): relocation truncated to fit: R_X86_64_PC32 against `.bss'
a.cc:(.text+0x283): relocation truncated to fit: R_X86_64_PC32 against `.bss'
collect2: error: ld returned 1 exit status
Language: C++

#include <iostream>
#include <vector>
#include <cmath>
#include <queue>
#include <deque>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <functional>
#include <bitset>
#include <utility>
#include <sstream>
#include <fstream>
#include <stack>
#include <cstdlib>
#include <complex>
#include <set>
#include <iomanip>

using namespace std;

#define INF 1070000000LL
#define pb push_back
#define irep(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) irep(i,0,n)

typedef long long lint;
typedef pair<int, int> pint;
typedef vector<vector<pint> > Graph;


int main(){
    int n,k;
    cin >> n >> k;
    double result = 0.0;
    int max_dice = 0;
    rep(i,n){
	if(k <= i+1){
	    result += 1;
	    continue;
	}
	else{
	    double tmp = k/(i+1);
	    int rp = ceil(log2(tmp));
	    result += 

Compiler output:
a.cc: In function 'int main()':
a.cc:46:22: error: expected primary-expression at end of input
   46 |             result +=
      |                      ^
a.cc:46:22: error: expected '}' at end of input
a.cc:43:13: note: to match this '{'
   43 |         else{
      |             ^
a.cc:46:22: error: expected '}' at end of input
   46 |             result +=
      |                      ^
a.cc:38:13: note: to match this '{'
   38 |     rep(i,n){
      |             ^
a.cc:46:22: error: expected '}' at end of input
   46 |             result +=
      |                      ^
a.cc:33:11: note: to match this '{'
   33 | int main(){
      |           ^
Language: C++

#include <iostream>
#include <string>
#include <cmath>
#include <iomanip>
using namespace std;

int main(void){
	long long double N,K;
	cin >> N >> K;
	
	long long double ans=0;
	
	for(long long double i=1 ;i<=N;i++){ // i is dice value 
        if(i>=K){
            ans+=(long long double)1.0/N;
            continue;
        }
		long long double n = ceil((log((long long double)K)-log((long long double)i))/log((long long double)2));
		ans+=pow((long long double)0.5,n)/N;
	}
	cout << std::setprecision(30) << ans;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:14: error: 'long long' specified with 'double'
    8 |         long long double N,K;
      |              ^~~~
a.cc:8:14: error: 'long long' specified with 'double'
a.cc:11:14: error: 'long long' specified with 'double'
   11 |         long long double ans=0;
      |              ^~~~
a.cc:13:18: error: 'long long' specified with 'double'
   13 |         for(long long double i=1 ;i<=N;i++){ // i is dice value
      |                  ^~~~
a.cc:15:24: error: 'long long' specified with 'double'
   15 |             ans+=(long long double)1.0/N;
      |                        ^~~~
a.cc:18:22: error: 'long long' specified with 'double'
   18 |                 long long double n = ceil((log((long long double)K)-log((long long double)i))/log((long long double)2));
      |                      ^~~~
a.cc:18:54: error: 'long long' specified with 'double'
   18 |                 long long double n = ceil((log((long long double)K)-log((long long double)i))/log((long long double)2));
      |                                                      ^~~~
a.cc:18:79: error: 'long long' specified with 'double'
   18 |                 long long double n = ceil((log((long long double)K)-log((long long double)i))/log((long long double)2));
      |                                                                               ^~~~
a.cc:18:105: error: 'long long' specified with 'double'
   18 |                 long long double n = ceil((log((long long double)K)-log((long long double)i))/log((long long double)2));
      |                                                                                                         ^~~~
a.cc:19:32: error: 'long long' specified with 'double'
   19 |                 ans+=pow((long long double)0.5,n)/N;
      |                                ^~~~
Language: C++

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

long long memo[100010];

long long log(int x) {
    long long ans = 0, s = 1;
    while (s < x) {
        ++ans;
        s *= 2;
    }
    return s;
}

int main(void) {
    long long n, k;
    cin >> n >> k;
    long long ans = 0;
    long long t, s = 1;
    while (s < k) {
        s *= 2;
    }
    t      = s;
    int nn = 1;
    for (int i = 1; i <= n; ++i) {
	if(i >= k) {
	    ans += n - k + 1;
	    brak;
	}
        ans += nn;
        if (i >= nn) {
            nn *= 2;
        }
    }

    double fans = (double)ans / (t * n);

    printf("%.15f\n", fans);
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:28:13: error: 'brak' was not declared in this scope; did you mean 'brk'?
   28 |             brak;
      |             ^~~~
      |             brk
Language: C++

#include<iostream>
#include <iomanip>
#include<stdio.h>
#include<string>
#include <math.h>
using namespace std;
# define maxn 100000 

int main(){
  // int N,u[maxn],v[maxn],w[maxn],col[maxn];
  // cin>>N;
  // for(int i(0);i<N;i++){
  //   cin>>u[i]>>c[i]>>w[i];
  // }
  // col[0]=1; 
  // 
  // for(int i(0);i<N;i++){
  //   
  // }
  long double sum(0);
  int N,K;
  cin>>N>>K;
  for(int i(1);i<=N;i++){
    int tmp=i;
    int cnt(0);
    for(int j(1);j<=K;j++){
      if (tmp>=K){
        break;
      }
      tmp*=2;
      cnt+=1;
    }
    sum += (long double)1.0/powl((long double)2.0,(long double)cnt);
  }
2 cout << setprecision(9)<< (long double)sum/N;


Compiler output:
a.cc: In function 'int main()':
a.cc:35:2: error: expected ';' before 'cout'
   35 | 2 cout << setprecision(9)<< (long double)sum/N;
      |  ^~~~~
      |  ;
a.cc:35:48: error: expected '}' at end of input
   35 | 2 cout << setprecision(9)<< (long double)sum/N;
      |                                                ^
a.cc:9:11: note: to match this '{'
    9 | int main(){
      |           ^
Language: C++

#include <iostream>
using namespace std;

int main() {
  int n,k;
  cin >> n >> k;
  int count =0;
  double ans =0;
  for (int i=1;i<=n;i++){
    k = k/i;
  for(int i=0;k==1;i++){
    k = k/2;
    count++;
  }
  int a=1;
  for(int i=0;i<count;i++){
    a*=2;
  }
  ans+={1/(n*a)};
  }
  cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:16: error: invalid use of brace-enclosed initializer list
   19 |   ans+={1/(n*a)};
      |                ^
Language: C++

#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
#define int ll

#define REP(i,n) for(int i=0;i<n;++i)
#define SORT(name) sort(name.begin(), name.end())
#define ZERO(p) memset(p, 0, sizeof(p))
#define MINUS(p) memset(p, -1, sizeof(p))
#if 1
#  define DBG(fmt, ...) printf(fmt, ##__VA_ARGS__)
#else
#  define DBG(fmt, ...)
#endif

const ll LLINF = (1LL<<60);
const int INF = (1LL<<30);
const double DINF = std::numeric_limits<double>::infinity();
const int MOD = 1000000007;
#define MAX_N 100010
#define MAX_K MAX_N

int N;
int K;
double k_num[MAX_K];    // 1/2^i
vector<int> fact(MAX_N, LLINF);    // 2^i

static inline ll bin_search2(const vector<ll>& v, ll lb, ll ub, ll val) {
    lb--; ub--;
    while(ub - lb > 1) {
        ll mid = (lb + ub) / 2;
        if(v[mid] >= val) { ub = mid; }
        else { lb = mid; }
    }
    // この時点で lb + 1 = ub
    return (v[ub] >= val) ? ub : -1;
}

ll get_need(ll n) {
    int cnt = 0;
    while(n < K) {
        n *= 2;
        cnt++;
    }
    return cnt;
}

signed main()
{
    cin >> N >> K;
    k_num[0] = 0;
    k_num[1] = 0.5;
    fact[0] = 1;
    fact[1] = 2;
    for(int i = 2; i < K; ++i) {
        k_num[i] = k_num[i-1] * 0.5;
        fact[i] = fact[i-1] * 2;
    }

    double ans = 0;
    REP(i, N) {
        int num = i + 1;    // 出た目
        double val;
        if(num > K) {
            val = 1.0 * k_num[need];
        }
        else {
            // 得点が K 以上になるのに必要な数
            int need = get_need(num);
            val = (1.0 / static_cast<double>(N)) * k_num[need];
        }
        ans += val;
    }
    printf("%.10f\n", ans);
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:66:31: error: 'need' was not declared in this scope
   66 |             val = 1.0 * k_num[need];
      |                               ^~~~
Language: C++

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

int main() {
  int N,K;
  scanf("%d %d", &N,&K);
  int AA = max(N,K)
  int a[AA];
  for(int i=0;i<AA;i++) a[i]=1;

  for(int i=1;i<17;i++){
    int BB = pow(2.0,i);
    if(BB>K) break;
    int turm = ceil(K/BB);
    if(K%BB==0) for(int j=0;j<turm-1;j++) a[j] = i+1;
    else for(int j=0;j<turm;j++) a[j] = i+1;
  }

  int count = 0;
  double ans = 0;
  double NN = N;

  for(int i=1;i<17;i++){
    for(int j=0;j<N;j++) if(a[j]==i) ++count;
    double CC = pow(0.5,i);
    ans += (1/NN) * CC * count;
    count = 0;
  }
  cout << fixed << setprecision(20);
  cout << ans << endl;

}



Compiler output:
a.cc: In function 'int main()':
a.cc:8:3: error: expected ',' or ';' before 'int'
    8 |   int a[AA];
      |   ^~~
a.cc:9:25: error: 'a' was not declared in this scope
    9 |   for(int i=0;i<AA;i++) a[i]=1;
      |                         ^
a.cc:15:43: error: 'a' was not declared in this scope
   15 |     if(K%BB==0) for(int j=0;j<turm-1;j++) a[j] = i+1;
      |                                           ^
a.cc:16:34: error: 'a' was not declared in this scope
   16 |     else for(int j=0;j<turm;j++) a[j] = i+1;
      |                                  ^
a.cc:24:29: error: 'a' was not declared in this scope
   24 |     for(int j=0;j<N;j++) if(a[j]==i) ++count;
      |                             ^
Language: C++

include<stdio.h>
int main(void) {
	double n, k;
	scanf("%lf", &n);
	scanf("%lf", &k);

	int  i;
	double ans = 0;

	int kuri = 0;
	kuri = k / n + 1;
	double kaijo  = 0.0;
		int j;
	for (i = 1; i <= n; i++) {
		kaijo = 0.5;
		
		for (j = kuri; j >= 1; j--) {
			kaijo = kaijo*0.5 ;
			printf("%lf", kaijo);
		}
		kuri--;
		ans = ans + ((1 / n) * kaijo);
		
	}
	
	printf("%.9f\n", ans);
	
	return 0;

}

Compiler output:
a.cc:1:1: error: 'include' does not name a type
    1 | include<stdio.h>
      | ^~~~~~~
Language: C++

#include <iostream>
#include <math.h>
#include <string>
#include <string.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <stdlib.h>
#include <deque>  
#include <iomanip>

using namespace std;

#define INF 1e9
#define MOD 1e9 + 7
#define rep(i, n) for(int i = 0; i < n; i++)
#define loop(i, a, n) for(int i = a; i < n; i++)
#define all(in) in.begin(), in.end()

int main(){
    int N, K;
    cin >> N >> K;
    double ans = 0;
    int R = N;
    if( N >= K){
        ans = (double) (N - K + 1)/N;
        R = K - 1;
    } 
    double prob = 1;
    int coin[100001] = {0};
    for(int i = R; i >= 1; i--){
        int count = 0;
        prob = 1;
        for(int k = i; k <= K; k = k * 2) count++;

        if(i != N){
                for(int k = 1; k <= count; k++) prob = 0.5 * prob;
            }
        }else{
            for(int k = 1; k <= count; k++) prob = 0.5 * prob;
        }
        coin[i] = count;
        ans = ans + (double)1/N * prob;
    }
    cout << setprecision(11) << ans << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:42:10: error: 'else' without a previous 'if'
   42 |         }else{
      |          ^~~~
a.cc:43:30: error: invalid operands of types 'int' and '<unresolved overloaded function type>' to binary 'operator<='
   43 |             for(int k = 1; k <= count; k++) prob = 0.5 * prob;
      |                            ~~^~~~~~~~
a.cc:45:14: error: 'i' was not declared in this scope
   45 |         coin[i] = count;
      |              ^
a.cc: At global scope:
a.cc:48:5: error: 'cout' does not name a type
   48 |     cout << setprecision(11) << ans << endl;
      |     ^~~~
a.cc:49:5: error: expected unqualified-id before 'return'
   49 |     return 0;
      |     ^~~~~~
a.cc:50:1: error: expected declaration before '}' token
   50 | }
      | ^
Language: Java

import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
        int k = sc.nextInt();
        double p = 0;
        int c = 0;
        for(int i=1; i<=n; i++){
          if(i >= k) p +~ 1/n;
          else {            
            for(int j=1; j<100000; j++){
              if(i+2^j >= k) {
                c = j;
                break;
              }
            }
            p += 1/n * (1/2)^c;
        }
        System.out.println(p);
    }
}


Compiler output:
Main.java:10: error: not a statement
          if(i >= k) p +~ 1/n;
                       ^
Main.java:22: error: reached end of file while parsing
}
 ^
2 errors
Language: C++

#include<iostream>
#include<string>
#include<vector>
using namespace std;

int main(void) {
	long double n, k, ans = 0;
	cin >> n >> k;
	for (int i = 1; i <= n; i++) {
		long double a = (long double)i;
		while (a < k) {
			a = a * 2;
		}
		ans += 1 / (n * pow(2, a));
	}
	cout << ans << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:33: error: 'pow' was not declared in this scope
   14 |                 ans += 1 / (n * pow(2, a));
      |                                 ^~~
Language: Java

import java.util.Scanner;

public class Main {
  public static void main (String[] args) {
    Scanner in = new Scanner(System.in);

    while (in.hasNext()) {
      double d = 1e-10;
      int N = in.nextInt();
      int K = in.nextInt();
      double prob = N >= K ? (N - K + 1) / (double)N : 0;
      

      for (int i = 1; i < K; ++i) {
        int point = i;
        int throw = 1;

        while (point * 1 << throw < K) {
          throw << 1;
        }
        
        prob += (1 / (double)N) * (1 / (double)throw) + d;
      }

      System.out.printf("%.9d\n",prob);
    }
  }
}

Compiler output:
Main.java:16: error: not a statement
        int throw = 1;
        ^
Main.java:16: error: ';' expected
        int throw = 1;
           ^
Main.java:16: error: illegal start of expression
        int throw = 1;
                  ^
Main.java:18: error: illegal start of expression
        while (point * 1 << throw < K) {
                            ^
Main.java:18: error: > or ',' expected
        while (point * 1 << throw < K) {
                                     ^
Main.java:19: error: illegal start of expression
          throw << 1;
                ^
Main.java:22: error: illegal start of expression
        prob += (1 / (double)N) * (1 / (double)throw) + d;
                                               ^
Main.java:22: error: illegal start of expression
        prob += (1 / (double)N) * (1 / (double)throw) + d;
                                                    ^
Main.java:22: error: not a statement
        prob += (1 / (double)N) * (1 / (double)throw) + d;
                                                        ^
9 errors
Language: C++

#include<iostream>
#include<cmath>
#include<cstdio>
#include<random>
using namespace std;

uint64_t get_rand() {
    // 乱数生成器（引数にシードを指定可能）
    static std::mt19937_64 mt64(0);

    // [0, (2^64)-1] の一様分布整数を生成
    return mt64();
}

uint64_t get_rand_range( uint64_t min_val, uint64_t max_val ) {
    // 乱数生成器
    static std::mt19937_64 mt64(0);

    // [min_val, max_val] の一様分布整数 (int) の分布生成器
    std::uniform_int_distribution<int> gen_rand_uni_int( min_val, max_val );

    // 乱数を生成
    return get_rand_uni_int(mt64);
}
int main(){
    int N, K;
    scanf("%d %d", &N ,&K)
    int p = 0;
    int r, q;
    r = get_rand_range( 1, N);
    for (int i = 0;i < 1000000; i++){
        while(0< r<K){
            q = get_rand_range(0,1);
            if(q == 0){
                break;
            }else{
                r = 2*r
                if ( r >= K){
                    p++
                    break;
                }
            }
        }
    }
    cout << p/1000000<< endl;

    return 0;
}

Compiler output:
a.cc: In function 'uint64_t get_rand_range(uint64_t, uint64_t)':
a.cc:23:12: error: 'get_rand_uni_int' was not declared in this scope; did you mean 'gen_rand_uni_int'?
   23 |     return get_rand_uni_int(mt64);
      |            ^~~~~~~~~~~~~~~~
      |            gen_rand_uni_int
a.cc: In function 'int main()':
a.cc:27:27: error: expected ';' before 'int'
   27 |     scanf("%d %d", &N ,&K)
      |                           ^
      |                           ;
   28 |     int p = 0;
      |     ~~~                    
a.cc:37:24: error: expected ';' before 'if'
   37 |                 r = 2*r
      |                        ^
      |                        ;
   38 |                 if ( r >= K){
      |                 ~~      
a.cc:45:13: error: 'p' was not declared in this scope
   45 |     cout << p/1000000<< endl;
      |             ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
  int a,b;
  cin>>a>>b;
  
  int n=1;
  int cnt;
  while(true){
    n*=2;
    if(n>b)
      break;
    cnt++;}
  double sum==0;
  
  for(int i=cnt; cnt>1; cnt--){
    sum+=1/(double)a*pow((double)1/2,cnt);
  }
  cout<<sum<<endl;
}
    

Compiler output:
a.cc: In function 'int main()':
a.cc:14:13: error: expected initializer before '==' token
   14 |   double sum==0;
      |             ^~
a.cc:17:5: error: 'sum' was not declared in this scope
   17 |     sum+=1/(double)a*pow((double)1/2,cnt);
      |     ^~~
a.cc:19:9: error: 'sum' was not declared in this scope
   19 |   cout<<sum<<endl;
      |         ^~~
Language: Java

import java.util.Scanner;
public class Main{
 public static void main(String[] args){
   Scanner sc = new Scanner(System.in);
   int K = K.nextInt();
   int N = N.nextInt();
   
   float ans =0.0f;
     for(int i =1;i<=N;i++){
       if(i>=K){
         ans += 1/N;
       }
       if(i<K){
         int j=0;
         int num = i;
         while(num>=K){
           j++;
           num = 2*num;
         }
         double a = 1/2;
         double b = (double)j;
         double nin = Math.pow(a,b);
           
         ans += (1/N)*nin;
       }
     }
     
     System.out.println(ans);
     
   

 }
}

Compiler output:
Main.java:5: error: int cannot be dereferenced
   int K = K.nextInt();
            ^
Main.java:6: error: int cannot be dereferenced
   int N = N.nextInt();
            ^
2 errors
Language: C++

#include <bits/stdc++.h>
using namespace std;
#include <math.h>
 
int main() {
  int N, K, sum=0;
  cin >> N >> K;
  
  for(int i=1, i <= N, i++){
    for(int j = 1, j < 20, j++){
      if(i*pow(2, j) > K){
        sum += ((1/N)*pow(0.5, j));
      	break;
      }
    }
  }
  
  cout << sum << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:17: error: expected ';' before '<=' token
    9 |   for(int i=1, i <= N, i++){
      |                 ^~~
      |                 ;
a.cc:9:18: error: expected primary-expression before '<=' token
    9 |   for(int i=1, i <= N, i++){
      |                  ^~
a.cc:9:27: error: expected ';' before ')' token
    9 |   for(int i=1, i <= N, i++){
      |                           ^
      |                           ;
a.cc:10:21: error: expected ';' before '<' token
   10 |     for(int j = 1, j < 20, j++){
      |                     ^~
      |                     ;
a.cc:10:22: error: expected primary-expression before '<' token
   10 |     for(int j = 1, j < 20, j++){
      |                      ^
a.cc:10:31: error: expected ';' before ')' token
   10 |     for(int j = 1, j < 20, j++){
      |                               ^
      |                               ;
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
  int a,b;
  cin>>a>>b;
  
  int n=1;
  int cnt;
  while(true){
    n*=2;
    if(n>b)
      break;
    cnt++;}
  double sum==0;
  
  for(int i=cnt; cnt>1; cnt--){
    sum=1/(double)a*pow((double)1/2,cnt);
  }
  cout<<sum<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:13: error: expected initializer before '==' token
   14 |   double sum==0;
      |             ^~
a.cc:17:5: error: 'sum' was not declared in this scope
   17 |     sum=1/(double)a*pow((double)1/2,cnt);
      |     ^~~
a.cc:19:9: error: 'sum' was not declared in this scope
   19 |   cout<<sum<<endl;
      |         ^~~
Language: C++

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

int main(void)
{
  double N,K,sum=0,s,c;
  
  cin >> N >> K;
  
  
  for(int i=1;i<=N;i++)
  {
    s=i;
    c=1;
    while(s<=K-1){
      s=s*2;
      c=c*0.5;
      
    }
    sum+=(1/N)*c;
  }
    
  cout << sum.12 << endl;

  return 0;
}
    


Compiler output:
a.cc: In function 'int main()':
a.cc:23:14: error: expected ';' before numeric constant
   23 |   cout << sum.12 << endl;
      |              ^~~
      |              ;
Language: Java

import java.util.*;
public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int K = sc.nextInt();

    Map<Integer, Integer> memo = new HashMap<>();
    
    int maxN = 0;
    int bunshi = 0;
    for (int i = 1; i <= N; i++) {
      int n = powern(i, K);
      if (i == 1) {
        maxN = n;
      }
      bunshi = bunshi + power2(maxN - n, memo);
    }
    int bunbo = N * power2(maxN, memo);

    System.out.println((double) bunshi / bunbo);
  }
  /*
  private static int power2(int n, Map<Integer, Integer> memo) {
    Integer cached = memo.get(n);
    if (cacehd != null) {
      return cached;
    }

    int ret = 1;
    for (int i = 0; i < n; i++) {
      ret = ret * 2;
    }
    memo.put(n, ret);
    return ret;
  }
  */
  
  private static int power2(int n, Map<Integer, Integer> memo) {
    Integer cached = memo.get(n);
    if (cached != null) {
      return cached;
    }
  
    if (n == 1) {
      return 1;
    }
    
    int tmp = power2(n/2);
    ret = tmp * tmp;
    if (n % 2 != 0) {
      ret = ret * 2;
    }
    memo.put(n, ret);

    return ret;
  }

  
  private static int powern(int a, int K) {

    int work = a;
    int ret = 0;
    
    while (work < K) {
      work = work * 2;
      ret++;
    }
    
    return ret;
  }  
}

Compiler output:
Main.java:49: error: method power2 in class Main cannot be applied to given types;
    int tmp = power2(n/2);
              ^
  required: int,Map<Integer,Integer>
  found:    int
  reason: actual and formal argument lists differ in length
Main.java:50: error: cannot find symbol
    ret = tmp * tmp;
    ^
  symbol:   variable ret
  location: class Main
Main.java:52: error: cannot find symbol
      ret = ret * 2;
      ^
  symbol:   variable ret
  location: class Main
Main.java:52: error: cannot find symbol
      ret = ret * 2;
            ^
  symbol:   variable ret
  location: class Main
Main.java:54: error: cannot find symbol
    memo.put(n, ret);
                ^
  symbol:   variable ret
  location: class Main
Main.java:56: error: cannot find symbol
    return ret;
           ^
  symbol:   variable ret
  location: class Main
6 errors
Language: C++

#include <bits/stdc++.h>

using namespace std;

int main() {

    long double N, M, A, B = 0, C = 1, D = 0, X = 0;
    long double ans = 1;
    long long now = 1;
    long double kote = 1;
    string S;

    cin >> N >> M;
    A = M;
    bool ka = false;
    kote = 1.0 / N;

    while(A > 0) {
        A = A >> 1;
        now *= 2.0;
    }

    D = (N >= M ? N - M + 1 : 0);

    for(long i = 1; i <= N; i++) {
        if(i >= M) {
            break;
        } else {

            while(i * now >= M) {
                now /= 2.0;
            }

            now *= 2;

            ans += kote / now;
        }
    }

    ans += (kote * D) - 1;

    cout << setprecision(11) << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:15: error: invalid operands of types 'long double' and 'int' to binary 'operator>>'
   19 |         A = A >> 1;
      |             ~ ^~ ~
      |             |    |
      |             |    int
      |             long double
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
typedef long long ll;

long double TENJO(int A,int X){
    if(A%X == 0){
        return A/X;
    }else{
        return A/X + 1;
    }
}

int main(){
    long long double N,K;
    cin >> N >> K;
    int cnt = 0;
    long long double NN = N;
    long long double ans = 0;
    while(true){
        K = TENJO(K,2);
        cnt = cnt + 1;
        if(K<=N) {
            ans = ans + (pow(0.5,cnt)) * (N - K + 1);
            N = K - 1;
        }
        if(K==1) break;
    }

    cout << ans/N << endl;

}


Compiler output:
a.cc: In function 'int main()':
a.cc:15:10: error: 'long long' specified with 'double'
   15 |     long long double N,K;
      |          ^~~~
a.cc:15:10: error: 'long long' specified with 'double'
a.cc:18:10: error: 'long long' specified with 'double'
   18 |     long long double NN = N;
      |          ^~~~
a.cc:19:10: error: 'long long' specified with 'double'
   19 |     long long double ans = 0;
      |          ^~~~
Language: C++

#include <algorithm>
#include <cmath>
#include <iomanip>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
ll n, k;
string str;

ll cal(ll n, ll k){
	if(n >= k){return 0;}
	
	ll r = 0;
	for(;n < k;r++){n *= 2;}
	return r;
}

int main(){
	cin >> n >> k;
	
	long double ans = 0.0;
	
	//cout << powl(2, 3) << endl;
	ll bunbo = powl(2, cal(n, k));
	
	for(ll i = 1; i <= n; i++){
		ans += 1.0 / pow(2, cal(i, k));
	}
	//long double ans = buf/bunbo;
	ans /= n;
	cout << setprecision(12) << ans << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:9: error: 'cin' was not declared in this scope
   19 |         cin >> n >> k;
      |         ^~~
a.cc:4:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    3 | #include <iomanip>
  +++ |+#include <iostream>
    4 | using namespace std;
a.cc:31:9: error: 'cout' was not declared in this scope
   31 |         cout << setprecision(12) << ans << endl;
      |         ^~~~
a.cc:31:9: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
Language: C++

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

int main()
{
	int N, K; cin >> N >> K;
	double win_sum = 0;
	double d = 0.5;
	double score = 1;

	for (int i = N; i <; i++) {
		int x = log2(K/(i+1)) / 1 + 1;
		double dice = 1.0;

		cout << x << endl;

		for (int j = 0; j < x; j++) {
			dice *= d;
		}

		cout << dice << endl;

		double win = dice / N;

		cout << win << endl;

		win_sum += win;

	}

	cout << win_sum << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:28: error: expected primary-expression before ';' token
   11 |         for (int i = N; i <; i++) {
      |                            ^
Language: C++

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

int main() {
  int n, k;
  cin >> n >> k;
  int iter, point;
  long long  prob;
  for (int i=1; i<n+1; i++) {
    point=i;
    if (point>=k) {
      prob+=1.0;
    }
    else {
/*      for (int j=0; j<k; j++) {*/
      int j=0;
      while (point*pow(2.0,j) < k) {
/*        if (point*pow(2.0,j) >= k) {
          iter=j;
        }*/
        j++:
        iter=j;
      }
      cout << iter << endl;
      prob+=pow(0.5,iter);
    }
  }
  cout << prob/n << endl;
  }


Compiler output:
a.cc: In function 'int main()':
a.cc:21:12: error: expected ';' before ':' token
   21 |         j++:
      |            ^
      |            ;
Language: C++

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

int main(void)
{
  int n,k;
  cin>>n>>k;//ok
  
  int a=n;
  double sum=0;
  //ok
  for(int i=1;i<=n;i++){
    int cout=0;
    for(int b=i;b<=k;cout++){
      b=b*2;
    }
    int e=1;
    for(int j=0;j<=0;cout;j++){
      e=e*2;
    }
    sum+=1/(e*a);
  }
  cout<<sum<<endl;

}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:26: error: expected ')' before ';' token
   18 |     for(int j=0;j<=0;cout;j++){
      |        ~                 ^
      |                          )
a.cc:18:27: error: 'j' was not declared in this scope
   18 |     for(int j=0;j<=0;cout;j++){
      |                           ^
Language: Java

import java.util.Scanner;
public class Main{
 public static void main(String[] args){
   Scanner sc = new Scanner(System.in);
   int K = K.nextInt();
   int N = N.nextInt();
   
   float ans =0.0f;
     for(int i =1;i<=N;i++){
       if(i>=K){
         ans += 1/N;
       }
       if(i<K){
         int j=0;
         int num = i;
         while(num>=K){
           j++;
           num = 2*num;
         }
         double a = 1/2;
         double b = (double)j;
         double nin = Math.pow(a,b);
           
         ans += (1/N)*nin;
       }
     }
     
     System.out.println(ans);
     
   }
   

 }
}

Compiler output:
Main.java:34: error: class, interface, enum, or record expected
}
^
1 error
Language: C++

#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <iostream>
#include <vector>
#include <numeric>
#include <string>
#include <functional>

using namespace std;
 
int main() {
  int n,k;
  cin >> n >> k;
  
  int ans;
  int fans;
  int cnt;
  if (n<k){
    for(int i=0;i<n;i++){
      ans = i+1;
      cnt = 0;
      while(true){
        ans = ans*2;
        cnt += 1;
        if(ans>k) break;
      }
      fans += pow(0.5,cnt) * (1/n);
    }
  }
  
  if (n>=k){
    for(int i=0;i<k;i++){
      ans = i+1;
      cnt = 0;
      while(true){
        ans = ans*2;
        cnt += 1;
        if(ans>k) break;
      }
      fans += pow(0.5,cnt) * (1/n);
    }
    fans += (1/n)*(n-k+1);
  }
  
  cout << fans <<endl
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:47:22: error: expected ';' before 'return'
   47 |   cout << fans <<endl
      |                      ^
      |                      ;
   48 |   return 0;
      |   ~~~~~~
Language: C++

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

int main() {
    double N, K;
    cin >> N >> K;
    double answer = 0;
    for(int i = 1 ; i <= N; i++) {
        if(i > K) {
            answer += 1;
            continue;
        }
        int n;
        n = ceil(log(K / i) / log(2));
        answer += pow(0.5, n);
    }
    answer /= N;
    cout << answer << endl;
    return 0;
}

Compiler output:
a.cc:1:10: fatal error: ../bits/stdc++.h: No such file or directory
    1 | #include "../bits/stdc++.h"
      |          ^~~~~~~~~~~~~~~~~~
compilation terminated.
Language: C++

#include <bits/stdc++.h>
using namespace std;
#include <math.h>
 
int main() {
  int N, K, sum=0;
  cin >> N >> K;
  
  for(int i=1 i <= N, i++){
    for(int j = 1, j < 20, j++){
      if(i*pow(2, j) > K){
        sum += ((1/N)*pow(0.5, j));
      	break;
      }
    }
  }
  
  cout << sum << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:14: error: expected ';' before 'i'
    9 |   for(int i=1 i <= N, i++){
      |              ^~
      |              ;
a.cc:9:26: error: expected ';' before ')' token
    9 |   for(int i=1 i <= N, i++){
      |                          ^
      |                          ;
a.cc:10:21: error: expected ';' before '<' token
   10 |     for(int j = 1, j < 20, j++){
      |                     ^~
      |                     ;
a.cc:10:22: error: expected primary-expression before '<' token
   10 |     for(int j = 1, j < 20, j++){
      |                      ^
a.cc:10:31: error: expected ';' before ')' token
   10 |     for(int j = 1, j < 20, j++){
      |                               ^
      |                               ;
Language: C++

#include <iostream>
#include <string>
#include <typeinfo>
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <math.h>
using namespace std;

int main(){
  int N,K;double wa = 1/2,count = 0.0;
  cin >> N >> K;
  int go;
  double ge = 1/N;
  double sum = 0.0;
  for(int i = 1;i < N+1; ++i ){
    for(count = 0;go < K ;){
     go = i * 2;
     count++
    }
    int a = pow(wa,count);
    sum += ge * a;
  }
  cout << sum << endl;

Compiler output:
a.cc: In function 'int main()':
a.cc:19:13: error: expected ';' before '}' token
   19 |      count++
      |             ^
      |             ;
   20 |     }
      |     ~        
a.cc:24:23: error: expected '}' at end of input
   24 |   cout << sum << endl;
      |                       ^
a.cc:10:11: note: to match this '{'
   10 | int main(){
      |           ^