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

#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
                
#define speedio ios_base::sync_with_stdio(false); cin.tie(NULL);
#define pretime float(clock()-clk)/CLOCKS_PER_SEC
#define max2(a,b) ((a)>(b) ? (a) : (b))   
#define min2(a,b) ((a)<(b) ? (a) : (b)) 
#define rep(i,a,b) for(i=a;i<=b;++i)
#define rev(i,a,b) for(i=a;i>=b;--i) 
#define all(x) x.begin(),x.end()
#define sz(x) (int)x.size()
#define lli long long int 
#define ins insert
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define PI 3.14159265
#define mod 1000000007
#define inf 1000000000000000

using namespace std;
typedef vector<lli>   vll;
typedef vector<int>   vi;
typedef set<lli>      sll;
typedef set<int>      si;
typedef pair<lli,lli> pll;
typedef pair<int,int> pii;
clock_t clk=clock();       
void solve(void);

int main()
{
  speedio;
   int t=1;  
  // cin>>t;
   while(t--)
     solve();

  return 0;
}
//

void solve()
{
	double n,k,i,j; cin>>n>>k;
	double ans=0.0;
	rep(i,1,n)
	{
		double temp=0.0;

		if(i>=k) 
		{
			ans+=(1/(n));
			continue;
		}

		lli val=log2(k/double(i));
		if(k-pow(2,val)*i<=0.0000000000001)
		{}
	    else 
			++val;
		
          temp=1/n;
          temp/=pow(2,val);
          ans+=temp;
	}
	cout<<fixed<<setprecision(12)<<ans;
	cout<<"\n":
}

Compiler output:
a.cc: In function 'void solve()':
a.cc:69:19: error: expected ';' before ':' token
   69 |         cout<<"\n":
      |                   ^
      |                   ;
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<=0cout;j++){
      e=e*2;
    }
    sum+=1/(e*a);
  }
  cout<<sum<<endl;

}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:20: error: unable to find numeric literal operator 'operator""cout'
   18 |     for(int j=0;j<=0cout;j++){
      |                    ^~~~~
Language: C

#include <iostream>
#include <cstdlib>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <functional>
#include <cmath>
#include <cstdlib>

using namespace std;

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

    int j = 1;
    while(j < k){
        j <<= 1;
    }
    int s = 0;
    for(int i = 1; i <= n; i++){
        if(i < k) {
            int p = 1;
            while(p <= k / i) {
                p <<= 1;
            }
            s += j / p;
        }else{
            s += j;
        }
    }

    cerr << s << " " << j << " " << endl;
    printf("%f\n", (double)s/j/n);

    return 0;
}


Compiler output:
main.c:1:10: fatal error: iostream: No such file or directory
    1 | #include <iostream>
      |          ^~~~~~~~~~
compilation terminated.
Language: C++

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

typedef long long ll;

int main() {
    int N,K;
    cin >> N >> K;
    int p = 1;
    int i = N;
    double ans = 0.0;
    while (i >= 1) {
        if ((double)((double)K/(double)p) <= (double)i && (double)i < (double)((double)K/(double)p*2.0)) {
            ans += (double)(1/(double)N/(double)p);
          	i--;
        }
        if ((double)i < double((double)K/(double)p)) p *= 2;
    }
    
    cout << fixed << setprecision(9) << ans << endl;

    return 0;
}

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

import java.util.*;

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

    int n = sc.nextInt();
    int k = sc.nextInt();

    

    int ans=0;
    for(int i=1 ; i<=n ; i++){
      int scr = 0;
      double ritu = 0;
      int kai = 0;
      for(int j=1 ; scr > k ;j++){
        scr = scr * 2;
        kai = j;
      }
      ans = ritu + 1/n * Math.pow(1/2, kai);
    }
   System.out.println(ans);
  }
}


Compiler output:
Main.java:21: error: incompatible types: possible lossy conversion from double to int
      ans = ritu + 1/n * Math.pow(1/2, kai);
                 ^
1 error
Language: Java

import java.util.*;

public class Main{
	public static void main(String[] args){
    	Scanner scan = new Scanner(System.in);
      	int n = scan.nextInt();
      	int K = scan.nextInt();
      	int counter = 0;
      	for(int i = 1; i <= n; i++){
        	if(i > K - 1){
            	break;
            }
          	else{
              	int j = i;
            	while(j < K){
                	j = j * 2
                    counter ++;
                }
            }
        }
      	int ans = (1/n) * (1/2)^counter;
      	System.out.print(ans);
    }

}

Compiler output:
Main.java:16: error: ';' expected
                	j = j * 2
                	         ^
1 error
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main()
  {
    int n,k,i=1,count=0,v;
    float l=0;
  cin>>n>>k;
 while(i<=n)
 {
 	 v=i;
    while(v<k)
    {
     v=v*2;
     count++;
    }
l=l+(float)log(n*pow(2,count));
    count=0;
    i++;
     }
   l=exe(-l);
    cout<<l;
    i++;
  }

Compiler output:
a.cc: In function 'int main()':
a.cc:20:6: error: 'exe' was not declared in this scope; did you mean 'exp'?
   20 |    l=exe(-l);
      |      ^~~
      |      exp
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 powern(int a, int K) {

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

Compiler output:
Main.java:26: error: cannot find symbol
    if (cacehd != null) {
        ^
  symbol:   variable cacehd
  location: class Main
1 error
Language: C++

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

int main(void) {
	double n, k, ans = 0;
	cin >> n >> k;
	for (double i = 1; i <= n; i++) {
		double a = (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.*;
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 powern(int a, int K) {

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

Compiler output:
Main.java:25: error: ';' expected
    Integer cached = memo.get(n)
                                ^
1 error
Language: C++

#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<cstdio>
#include<cstdlib>
#include<string>
#include<iostream>
#include <iomanip>
#include<queue>
#include<algorithm>
#include <functional>
#include<vector>
#include <math.h>
using namespace std;

long double N;
int K;
long double ans = 0;

int main() {
	cin >> N >> K;
	int idx = 1;
	if (N < K) {
		for (int i = N; i > 0; i--) {
			while (i*pow(2, idx) < K) idx++;
			if (i*pow(2, idx) >= K) {
				ans += (long double(1.0) / N)*pow(long double(0.5), long double(idx));
			}
		}
		cout << setprecision(12) << ans << endl;
	}
	else {
		for (int i = K - 1; i > 0; i--) {
			while (i*pow(2, idx) < K) idx++;
			if (i*pow(2, idx) >= K) {
				ans += (long double(1.0) / long double(N))*(long double)pow(long double(0.5), long double(idx));
			}
		}
		ans += (long double(1.0) / long double(N))*long double((N - K + 1));
		cout << setprecision(12) << ans << endl;
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:26:41: error: expected primary-expression before 'long'
   26 |                                 ans += (long double(1.0) / N)*pow(long double(0.5), long double(idx));
      |                                         ^~~~
a.cc:26:41: error: expected ')' before 'long'
   26 |                                 ans += (long double(1.0) / N)*pow(long double(0.5), long double(idx));
      |                                        ~^~~~
      |                                         )
a.cc:35:41: error: expected primary-expression before 'long'
   35 |                                 ans += (long double(1.0) / long double(N))*(long double)pow(long double(0.5), long double(idx));
      |                                         ^~~~
a.cc:35:41: error: expected ')' before 'long'
   35 |                                 ans += (long double(1.0) / long double(N))*(long double)pow(long double(0.5), long double(idx));
      |                                        ~^~~~
      |                                         )
a.cc:38:25: error: expected primary-expression before 'long'
   38 |                 ans += (long double(1.0) / long double(N))*long double((N - K + 1));
      |                         ^~~~
a.cc:38:25: error: expected ')' before 'long'
   38 |                 ans += (long double(1.0) / long double(N))*long double((N - K + 1));
      |                        ~^~~~
      |                         )
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
#define REP(i,n) for(int i=0; i < (n); ++i)
#define REPR(i,n) for(int i=(n); i >=0; --i)
#define FOR(i, m, n) for(int i = (m); i < (n); ++i)
 
typedef long long ll;
#define INF 1e9
 
int main(){
  int N, K;
  cin >> N >> K;
  vector<int> p(2*1e5+9, 0);
  vector<int> bai(18, 1);
  FOR(i, 1, 18){
    bai[i] = bai[i-1]*2;
  }
  FOR(i, 1, N+1){
    if(i < K){
      ll me = i;
      while(me <= K){
        me*=2;
        p[i]++;
      }
    }
  }
  // FOR(i, 1, N+1){
  //   if(i < K && p[i] == 0){
  //     ll me = i;
  //     while(me <= K){
  //       me*=2;
  //       p[i]++;
  //     }
  //     me = i;
  //     while(me <= K){
  //       me*=2;
  //       p[me] = p[me/2] - 1;
  //     }
  //   }
  //   else if(p[i] != 0){
  //     continue;
  //   }
  // }
  double ans=0;
  FOR(i, 1, N+1){
    int me = 1;
    REP(j, 17 - p[i]){
      me *=2;
    }
    ans += me;
  }
  while(ans % 2 == 0){
    ans /= 2;
    bai[17]/=2;
  }
  ans /= bai[17];
  ans /= N;
  printf("%.12lf\n", ans);
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:53:13: error: invalid operands of types 'double' and 'int' to binary 'operator%'
   53 |   while(ans % 2 == 0){
      |         ~~~ ^ ~
      |         |     |
      |         |     int
      |         double
Language: C++

#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<cstdio>
#include<cstdlib>
#include<string>
#include<iostream>
#include <iomanip>
#include<queue>
#include<algorithm>
#include <functional>
#include<vector>
#include <math.h>
using namespace std;

long double N;
int K;
long double ans = 0;

int main() {
	cin >> N >> K;
	int idx = 1;
	if (N < K) {
		for (int i = N; i > 0; i--) {
			while (i*pow(2, idx) < K) idx++;
			if (i*pow(2, idx) >= K) {
				ans += (long double(1.0) / N)*pow(long double(0.5), long double(idx));
			}
		}
		cout << setprecision(12) << ans << endl;
	}
	else {
		for (int i = K - 1; i > 0; i--) {
			while (i*pow(2, idx) < K) idx++;
			if (i*pow(2, idx) >= K) {
				ans += (long double(1.0) / long double(N))*(long double)pow(long double(0.5), long double(idx));
				cout << setprecision(12) << ans << endl;
			}
		}
		ans += (long double(1.0) / long double(N))*long double((N - K + 1));
		cout << setprecision(12) << ans << endl;
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:26:41: error: expected primary-expression before 'long'
   26 |                                 ans += (long double(1.0) / N)*pow(long double(0.5), long double(idx));
      |                                         ^~~~
a.cc:26:41: error: expected ')' before 'long'
   26 |                                 ans += (long double(1.0) / N)*pow(long double(0.5), long double(idx));
      |                                        ~^~~~
      |                                         )
a.cc:35:41: error: expected primary-expression before 'long'
   35 |                                 ans += (long double(1.0) / long double(N))*(long double)pow(long double(0.5), long double(idx));
      |                                         ^~~~
a.cc:35:41: error: expected ')' before 'long'
   35 |                                 ans += (long double(1.0) / long double(N))*(long double)pow(long double(0.5), long double(idx));
      |                                        ~^~~~
      |                                         )
a.cc:39:25: error: expected primary-expression before 'long'
   39 |                 ans += (long double(1.0) / long double(N))*long double((N - K + 1));
      |                         ^~~~
a.cc:39:25: error: expected ')' before 'long'
   39 |                 ans += (long double(1.0) / long double(N))*long double((N - K + 1));
      |                        ~^~~~
      |                         )
Language: C++

#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
                
#define speedio ios_base::sync_with_stdio(false); cin.tie(NULL);
#define pretime float(clock()-clk)/CLOCKS_PER_SEC
#define max2(a,b) ((a)>(b) ? (a) : (b))   
#define min2(a,b) ((a)<(b) ? (a) : (b)) 
#define rep(i,a,b) for(i=a;i<=b;++i)
#define rev(i,a,b) for(i=a;i>=b;--i) 
#define all(x) x.begin(),x.end()
#define sz(x) (int)x.size()
#define lli long long int 
#define ins insert
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define PI 3.14159265
#define mod 1000000007
#define inf 1000000000000000

using namespace std;
typedef vector<lli>   vll;
typedef vector<int>   vi;
typedef set<lli>      sll;
typedef set<int>      si;
typedef pair<lli,lli> pll;
typedef pair<int,int> pii;
clock_t clk=clock();       

lli i,j;
void solve(void);

int main()
{
  speedio;
   int t=1;  
  // cin>>t;
   while(t--)
     solve();

  return 0;
}
//

void solve()
{
	double n,k; cin>>n>>k;
	double ans=0.0;

	rep(i,1,n)
	{
		double temp=0.0;

		if(i>=k) 
		{
			ans+=(1/(n));
			continue;
		}

		lli val=log2(k/double(i));
		if(pow(2,val)*i!=k)
			++val;
		
          temp=1/n;
          temp/=power(2,val);
          ans+=temp;
	}
	cout<<"\n"<<fixed<<setprecision(10)<<ans;
}

Compiler output:
a.cc: In function 'void solve()':
a.cc:66:17: error: 'power' was not declared in this scope
   66 |           temp/=power(2,val);
      |                 ^~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int main() {
  double N,K;
  cin >> N >> K;
  
  double ans;
  ans = N;
  
  double i;//カウンタ
  i = 0;
  
  while(ans < K){
    ans = 2.0*ans;
    i = i++;
  }
  
  cout <<     (1 / 3.0) * ( pow((1/2.0),i) )　<< endl;

    
}

Compiler output:
a.cc:19:45: error: extended character 　 is not valid in an identifier
   19 |   cout <<     (1 / 3.0) * ( pow((1/2.0),i) )　<< endl;
      |                                             ^
a.cc: In function 'int main()':
a.cc:19:45: error: expected ';' before '\U00003000'
   19 |   cout <<     (1 / 3.0) * ( pow((1/2.0),i) )　<< endl;
      |                                             ^~
      |                                             ;
Language: C++

#include <iostream>
#include <algorithm>

using namespace std;

long kakeru = 10000000000;


int main()
{
	int n, k;
	cin >> n >> k;
	long answer = 0;
	int sisuu = 2;
	int min_kako = n+1;
	if (n >= k) {
		answer += (kakeru * (n - k + 1)) / n;
		min_kako = k;
	}
	while (1) {
		int min = (k-1) / sisuu + 1;
		if (min > n) {
			sisuu *= 2;
			continue;
		}
		answer += (kakeru * (min_kako - min) / n) / sisuu;
		if (min <= 1) break;
		sisuu *= 2;
		min_kako = min;
	}
	cout << answer/kakeru << "." << answer % kakeru << endl;
    return 0;


Compiler output:
a.cc: In function 'int main()':
a.cc:32:14: error: expected '}' at end of input
   32 |     return 0;
      |              ^
a.cc:10:1: note: to match this '{'
   10 | {
      | ^
Language: Java

import java.util.*;
import java.io.*;

public class Main {
  public static void main(String ... args) throws Exception {
    int n = 0, k = 0;
    String s;
    try (BufferedReader isr = new BufferedReader(new InputStreamReader(System.in))) {
      String buf = isr.readLine();
      System.err.println(buf);
      //
      String[] input = buf.split(" ");
      n = Integer.parseInt(input[0]);
      k = Integer.parseInt(input[1]);
      /*
      buf = isr.readLine();
      System.err.println(buf);
      // */
      s = buf;
    }

    System.err.println(Math.log1p((double)k/n - 1));
    System.err.println(Math.pow(0.5, (int)Math.ceil(4));
    double res = 0;
    for (int i=1; i<=n; i++) {
      double d = Math.log1p((double)k/n - 1);
      res += Math.pow(0.5, (int)Math.ceil(d)) / n;
    }
    
    System.out.println(res);
  }

}


Compiler output:
Main.java:23: error: ')' or ',' expected
    System.err.println(Math.pow(0.5, (int)Math.ceil(4));
                                                       ^
1 error
Language: C++

#include <stdio.h>
#include <stdlib.h>
int main(void){
	int n, k;
	int i;
	int kk, cnt;
	long double ans;
	scanf("%d %d", &n, &k);

	kk = 1;
	cnt = 0;
	for (i = 1;  i <= 17; i++) {	
		kk *= 2;
		if (k < kk) {
			cnt = i; 
			break;
		}
	}
	ans = 0.0;
	for (i = 0; i < n; i++) {
		if (cnt - i > 0) {
			ans += powl(0.5, cnt - i);
		}
		else {
			ans += 1.0;
		}
	}
	ans *= (1.0/(long double)n);
	printf ("%14.12llf", ans);

	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:22:32: error: 'powl' was not declared in this scope
   22 |                         ans += powl(0.5, cnt - i);
      |                                ^~~~
Language: C++

#include<string>
#include<cstdlib>
#include <typeinfo>
#include <cmath>
using namespace std;


int main(){
    float N ,K;
    int max;
    float sum = 0;
    cin >> N >> K;

    for(int i = 1; i < 100000; i++){
        if (K <= pow(2.0, i)){
            max = i;
            break;
        }
    }
    for (int i = 1; i <= N ; i++){
        sum += 1.0/N * 1.0/pow(2.0, max);
        max--;
    }
    cout << sum << endl; 
    
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:5: error: 'cin' was not declared in this scope
   12 |     cin >> N >> K;
      |     ^~~
a.cc:5:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    4 | #include <cmath>
  +++ |+#include <iostream>
    5 | using namespace std;
a.cc:24:5: error: 'cout' was not declared in this scope
   24 |     cout << sum << endl;
      |     ^~~~
a.cc:24:5: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:24:20: error: 'endl' was not declared in this scope
   24 |     cout << sum << endl;
      |                    ^~~~
a.cc:5:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
    4 | #include <cmath>
  +++ |+#include <ostream>
    5 | using namespace std;
Language: C++

#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<array>

typedef long long ll;

using namespace std;

int power(int n){
  if( n == 0){return 1;}
  else{
    return 2 * power( n - 1 );}}

//2のn乗を計算



int main(){
int N, K; cin >> N >> K;
  
 long double ans = 0;
  
  if( K == 1) { cout << "1.000000000000" ; return 0;}
  else{
    
  if( N >= K ){ 
   ans +=  (long double) (( N - K + 1 )/ K );}
  
 
    
   for(int x = 1; x <= min(N,K - 1); x++){
    for(int m = 0; m < 20 ; m++){ int m0;
      if( (long double)power(m) >= (long double) K / x){ m0 = m; break;}}
      // power(m0) >= K / x　なる最小のm0が欲しい
      ans += (long double) 1 / (long double) power(m0);}
    
    cout << ans << endl;}

    return 0;
  }
  

Compiler output:
a.cc: In function 'int main()':
a.cc:37:52: error: 'm0' was not declared in this scope
   37 |       ans += (long double) 1 / (long double) power(m0);}
      |                                                    ^~
Language: Java

public class Main {
	
	public static void main(String[] args) {
		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:4: error: cannot find symbol
		Scanner sc = new Scanner(System.in);
		^
  symbol:   class Scanner
  location: class Main
Main.java:4: error: cannot find symbol
		Scanner sc = new Scanner(System.in);
		                 ^
  symbol:   class Scanner
  location: class Main
2 errors
Language: C

#include<stdio.h>
int main(){
  int N,K,sum;
  float per;
  cin>>N>>K;
  sum=N;
  per=(1/N);
  
  if(K<N){
    per=((N-K)/N);
  }
  else{
  while(0){
    
    sum*=2;
    per/=2;
    
    if(sum>K)
      break;
  }
  }
  
  printf("%f",per);
}

Compiler output:
main.c: In function 'main':
main.c:5:3: error: 'cin' undeclared (first use in this function)
    5 |   cin>>N>>K;
      |   ^~~
main.c:5:3: note: each undeclared identifier is reported only once for each function it appears in
Language: C++

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

int main() {
  int n, k; cin >> n >> k;
  double ans = 0;

  for(int i = 1; i <= n; i++) {
    if(i < k) {
      int tmp = i, cnt = 0;
      while(tmp < k) {
        tmp *= 2;
        cnt++;
      }
      ans += (double)1/n * pow(0.5, (double)cnt);
    }
    if(i >= k) {
      ans += (double)1/n;
  }

  cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:23:2: error: expected '}' at end of input
   23 | }
      |  ^
a.cc:5:12: note: to match this '{'
    5 | int main() {
      |            ^
Language: C++

#include <bits/stdc++.h>
#include <math.h>
using namespace std;
 
int main() {
	int i,n,k;
  	i=1;
    double a,p;
    p=0;
  	cin >>n,k;
  	while(i<=n){
    	a=ceil(log2(k/i));	
        p=p+(1/2)^a;
     	i++;
   
  	cout<p/n<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:18: error: invalid operands of types 'double' and 'double' to binary 'operator^'
   13 |         p=p+(1/2)^a;
      |           ~~~~~~~^~
      |            |      |
      |            double double
a.cc:16:17: error: invalid operands of types 'double' and '<unresolved overloaded function type>' to binary 'operator<<'
   16 |         cout<p/n<<endl;
      |              ~~~^~~~~~
a.cc:17:2: error: expected '}' at end of input
   17 | }
      |  ^
a.cc:5:12: note: to match this '{'
    5 | int main() {
      |            ^
Language: C++

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

using namespace std;

int main () {
    int N, K;
    cin >> N >> K;
    double sum = 0;
    int db =  2;
    int count = 0;

    if (N >= K) {
        sum += (double) (N - K + 1) / N;
    }

    for (int i = 0; i < 40; i++) {
        int memo = 0;
        if (db * N >= K) {
            if (count == 0) {
                memo = N - ceil((double) K / db) + 1;
            }
            else {
                memo = ceil((double) (K * 2) / db) - ceil((double) K / db);
            }
            count++;
            sum += (double) memo / (N * db);
        }
        db *= 2;
    }
    cout << fixed << setprecision(10);
    cout << sum << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:32:22: error: 'setprecision' was not declared in this scope
   32 |     cout << fixed << setprecision(10);
      |                      ^~~~~~~~~~~~
a.cc:4:1: note: 'std::setprecision' is defined in header '<iomanip>'; this is probably fixable by adding '#include <iomanip>'
    3 | #include <math.h>
  +++ |+#include <iomanip>
    4 |
Language: C++

#include<iostream>
#include<cmath>

int main() {
	int n,k;
	long double sum = 0;
	std::cin >> n>>k;


	for (int i = 0; i < n; i++) {
		int m = i+1;
		long double count=0;
		long double ans;
		while (k > m) {
			count=count+1.0;
			m *= 2;
		}

		//std::cout << count << std::endl;

		//std::cout << std::pow(0.5, count) << std::endl;

		ans = std::pow(0.5,count)/n;

		//std::cout << ans << std::endl;

		sum += ans;
	}

Compiler output:
a.cc: In function 'int main()':
a.cc:28:10: error: expected '}' at end of input
   28 |         }
      |          ^
a.cc:4:12: note: to match this '{'
    4 | int main() {
      |            ^
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 double N,K;
    cin >> N >> K;
    int cnt = 0;
    long double ans = 0;
    while(K>1){
        K = TENJO(K,2);
        cnt = cnt + 1;
        if(K<=N) {
            ans = (ans + pow(0.5,cnt)) * (N - K);
        }
    }

    cout << ans/N << endl;


Compiler output:
a.cc: In function 'int main()':
a.cc:27:27: error: expected '}' at end of input
   27 |     cout << ans/N << endl;
      |                           ^
a.cc:14:11: note: to match this '{'
   14 | int main(){
      |           ^
Language: C++

#include <iostream>
#include <iomanip>

using namespace std;
int main()
{
	double c = 1;
	double i, k;
	double N, K;
	double a;//勝つための回数
	double b;//現在の点数
	double x=0;//確率
	cin >> N >> K;
	for (i = 1; i < N+1; i++) {
		a = 0;
		b = i;
		while (b < K) {
			b = b * 2;
			a += 1.0;
		}
		x += (c / N)*(pow(0.5,a));
	}
	cout << std::setprecision(10)<<x;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:21:31: error: 'pow' was not declared in this scope
   21 |                 x += (c / N)*(pow(0.5,a));
      |                               ^~~
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][100100];
    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 < 100100;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/ccjmvpVK.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>
using namespace std;

int main() {

	double win = 0;
	int N, K;
	int count;
	cin >> N >> K;

	for (int dice = N; dice >= 1; dice--) {
		count = 0;

		while (dice * pow(2, count) <= K) {
			count++;
		}

		win += 1 / (pow(2, count));
		//cout << count << " " << pow(2, count) << " " << dice << endl;
	}

	cout << win / N << endl;

	return 0;
}
//*/

Compiler output:
a.cc: In function 'int main()':
a.cc:15:31: error: 'pow' was not declared in this scope
   15 |                 while (dice * pow(2, count) <= K) {
      |                               ^~~
a.cc:19:29: error: 'pow' was not declared in this scope
   19 |                 win += 1 / (pow(2, count));
      |                             ^~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define ll long long
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	int n,k;
	cin >> n >> k;
	cout << fixed << setprecision(12);
	double sum=0;
	if(n<=2 && k<=2)
	{
		cout << double(1); return 0;
	}
	for(int i=0;i<n;i++)
	{
		if(i+1>=k)
		{
			sum+=double(1)/double(n);
		}
		else
		{
			sum+=double(1)/double(n)*double(pow(double(1)/double(2),(int)log2(k/(i+1))+1));
		}
	}
	cout << sum << endl;
	return 0;


Compiler output:
a.cc: In function 'int main()':
a.cc:29:18: error: expected '}' at end of input
   29 |         return 0;
      |                  ^
a.cc:6:1: note: to match this '{'
    6 | {
      | ^
Language: C++

#include<stdio.h>
#include<iostream>
#include<vector>
#include<utility>
#include<algorithm>
#include<map>
#include<cmath>
#include<math.h>

using namespace std;
using ll = long long int;

int n, k;

int main(void) {
	cin >> n >> k;
	long double ret = 0., tmp;
	for (int i = 1; i <= n; i++) {
		int win = ceil(log2(double(k) / i));
		tmp = pow(2, -1 * win);
		if (tmp > 1.)
			tmp = 1.;
		ret += tmp;
	}
	printf("%.20lf\n", long double(ret) / n);
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:25:28: error: expected primary-expression before 'long'
   25 |         printf("%.20lf\n", long double(ret) / n);
      |                            ^~~~
Language: C++

#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <stack>
#include <math.h>
#include <map>
#include <time.h>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;

#define pb push_back
#define rep(i, a, n) for(int i = (a); i < (n); i++)
#define dep(i, a, n) for(int i = (a); i >= (n); i--)
#define mod (ll)(1e9+7)
#define int ll

__attribute__((constructor))
void initial() {
  cin.tie(0);
  ios::sync_with_stdio(false);
}

signed main() {
  double n, k;
  cin >> n >> k;
  double kt = 0;
  int sk = 1;
  int kn = n;
  dep(i, kn, 1) {
    while(k > i * sk) n *= 2, sk *= 2;
    kt += 1 / n;
  }

  cout << fixed << setprecision(10) << kt << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:39:20: error: 'setprecision' was not declared in this scope
   39 |   cout << fixed << setprecision(10) << kt << endl;
      |                    ^~~~~~~~~~~~
a.cc:8:1: note: 'std::setprecision' is defined in header '<iomanip>'; this is probably fixable by adding '#include <iomanip>'
    7 | #include <map>
  +++ |+#include <iomanip>
    8 | #include <time.h>
Language: Java

import java.util.*;
import java.io.*;

public class Main {
  public static void main(String ... args) throws Exception {
    int n = 0, k = 0;
    String s;
    try (BufferedReader isr = new BufferedReader(new InputStreamReader(System.in))) {
      String buf = isr.readLine();
      System.err.println(buf);
      //
      String[] input = buf.split(" ");
      n = Integer.parseInt(input[0]);
      k = Integer.parseInt(input[1]);
      /*
      buf = isr.readLine();
      System.err.println(buf);
      // */
      s = buf;
    }

    double res = 0;
    for (int i=1; i<=n; i++) {
      double d = Math.log1p(k/n - 1);
      res += Math.pow(0.5, (int)Math.ceail(d));
    }
    
    System.out.println(res);
  }

}


Compiler output:
Main.java:25: error: cannot find symbol
      res += Math.pow(0.5, (int)Math.ceail(d));
                                    ^
  symbol:   method ceail(double)
  location: class Math
1 error
Language: C++

#include <cstdio>
#include <iostream>
#include <string>
#include <cstdlib>

using namespace std;
int main(){
	int n,k;
	long double ans=0;

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

	for(int i=1;i<=n;i++){
		int coinN=0;
		int point=i;
		//printf("saikoro:%d\n",i);
		while(point<k){
			coinN++;
			point*=2;
			//printf("point:%d\n",point);
		}
		//printf("%lf",(1.0/(long double)n)*pow(1.0/2.0,(long double)coinN));
		//cout<<endl;
		ans+=(1.0/(long double)n)*pow(1.0/2.0,(long double)coinN);
	}
	cout<<ans;

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:24:43: error: 'pow' was not declared in this scope
   24 |                 ans+=(1.0/(long double)n)*pow(1.0/2.0,(long double)coinN);
      |                                           ^~~
Language: C++

#include <iostream>
#include <iomanip>
#include <string>
#include <map>
#include <math.h>
using namespace std;

#define ll long long

int main(){
    double N,K,ans = 0;
    cin >> N >> K;
    for(double i = 0; i < N; i++){
        for(double j = 0; j < 14; j++){
            if((i+1)*pow(2,j) >= K){
                ans += 1/N * pow(0.5,j);
                break;
            }
        }
    }
    cout << setprecision(20) << ans << endl;
    return 0;
}#include <iostream>
#include <iomanip>
#include <string>
#include <map>
#include <math.h>
using namespace std;

#define ll long long

int main(){
    double N,K,ans = 0;
    cin >> N >> K;
    for(double i = 0; i < N; i++){
        for(double j = 0; j < 17; j++){
            if((i+1)*pow(2,j) >= K){
                ans += 1/N * pow(0.5,j);
                break;
            }
        }
    }
    cout << setprecision(20) << ans << endl;
    return 0;
}

Compiler output:
a.cc:23:2: error: stray '#' in program
   23 | }#include <iostream>
      |  ^
a.cc:23:3: error: 'include' does not name a type
   23 | }#include <iostream>
      |   ^~~~~~~
a.cc:32:5: error: redefinition of 'int main()'
   32 | int main(){
      |     ^~~~
a.cc:10:5: note: 'int main()' previously defined here
   10 | int main(){
      |     ^~~~
Language: C++

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

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

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

    cout << ans/N << endl;

}

Compiler output:
a.cc: In function 'long double TENJO(long double, long double)':
a.cc:7:9: error: invalid operands of types 'long double' and 'long double' to binary 'operator%'
    7 |     if(A%X == 0){
      |        ~^~
      |        | |
      |        | long double
      |        long double
a.cc:12:1: warning: control reaches end of non-void function [-Wreturn-type]
   12 | }
      | ^
Language: C++

#include<stdio.h>
#include<vector>
#include <algorithm>
#include<string>
#include<math.h>

using namespace std;

int main(){
        int b,i,n=0;
        long double a,ans=0.0;
        cin >> a >> b;
        for(i=1;i<=a;i++){
                if(i>=b){
                        ans+=(long double)1/a;
                }else{
                        n=ceil(b/i);
                        n=ceil(log2(n));
                        ans+=((long double)1/a)*pow(0.5,n);
                }
        }
        cout << ans;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:12:9: error: 'cin' was not declared in this scope
   12 |         cin >> a >> b;
      |         ^~~
a.cc:6:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    5 | #include<math.h>
  +++ |+#include <iostream>
    6 | 
a.cc:22:9: error: 'cout' was not declared in this scope
   22 |         cout << ans;
      |         ^~~~
a.cc:22:9: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
Language: C++

using namespace std;

int main() {
	
	int N, K;

	cin >> N;
	cin >> K;

	double front;

	double sum = 0;

	for (int i = 1; i < N+1; i++) {

		int j = i;
		front = 1.0/(double)N;
		while (j<K) {
			
			j *= 2;

			front *= 0.50;
		}

		sum += front;
	}

	cout << sum << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:9: error: 'cin' was not declared in this scope
    7 |         cin >> N;
      |         ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
  +++ |+#include <iostream>
    1 | using namespace std;
a.cc:28:9: error: 'cout' was not declared in this scope
   28 |         cout << sum << endl;
      |         ^~~~
a.cc:28:9: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:28:24: error: 'endl' was not declared in this scope
   28 |         cout << sum << endl;
      |                        ^~~~
a.cc:1:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
  +++ |+#include <ostream>
    1 | using namespace std;
Language: C++

#include<iostream>
#include<algorithm>
#include<cstdlib>
#include<string>
#include<math.h>
using namespace std;
int main()
{
  double n, k;
  double ans=0;
  cin >> n >> k;
  if(n>=k){
    for(int i=0; i++; i<(n-k+1)) ans=ans+(1/n)*0.5^(ceil(log2(k/i)));
    ans=ans+(n-k+1)/n;
  }
  else{
    for(int i=0; i++; i<n) ans=ans+(1/n)*0.5^(ceil(log2(k/i)));
  }
  cout<<ans;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:51: error: invalid operands of types 'double' and 'double' to binary 'operator^'
   13 |     for(int i=0; i++; i<(n-k+1)) ans=ans+(1/n)*0.5^(ceil(log2(k/i)));
      |                                      ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
      |                                         |               |
      |                                         double          double
a.cc:17:45: error: invalid operands of types 'double' and 'double' to binary 'operator^'
   17 |     for(int i=0; i++; i<n) ans=ans+(1/n)*0.5^(ceil(log2(k/i)));
      |                                ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
      |                                   |               |
      |                                   double          double
Language: C++

#include <iostream>
#include <string>
#include <time.h>
#include <algorithm>
#include <map>
#include <set>
#include <vector>
using namespace std;
typedef long long  ll;
static const ll INF = (ll)1 << 62;
#define rep(i,s,n)for(ll i=s;i<n;i++)
#define repe(i,s,n)for(ll i=s;i<=n;i++)

static const ll MOD = 1e9 + 7;
ll Pow(ll n, ll p) {
	if (p == 0)return 1;
	if (p == 1)return n;
	ll t = Pow(n, p / 2);
	if (p & 1) return (t * t % MOD) * n % MOD;
	else return t * t % MOD;
}

int main() {
	ll n, k; cin >> n >> k;
	double p = 0;
	if (k <= n) {
		p += ((double)(n - k + 1) / (double)n);
	}

	ll a = min(k - 1, n);
	ll b = 0;
	ll t = a;
	while (k > t) {
		t *= 2;
		b++;
	}

	ll m;
	while (a >= 1) {
		if (a == 2 || a == 1 || a == 3) m = 1;
		else  m = a - a / 2;

		double q = (double)(m * (double)1 / pow(2, b)* (double)1 / n);
		p += q;
		//next
		b++;
		a -= m;
	}

	printf("%.10f", p);

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:43:53: error: 'pow' was not declared in this scope; did you mean 'Pow'?
   43 |                 double q = (double)(m * (double)1 / pow(2, b)* (double)1 / n);
      |                                                     ^~~
      |                                                     Pow
Language: C++

#include <iostream>
#include <string>
using namespace std;
int main()
{
	double i, k;
	double N, K;
	double a;//勝つための回数
	int b;//現在の点数
	double x=0;//確率
	cin >> N >> K;
	for (i = 1; i < N+1; i++) {
		a = 0;
		b = i;
		while (b < K) {
			b = b * 2;
			a += 1.0;
		}
		x += (1 / N)*(pow(0.5,a));
	}
	cout << x;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:19:31: error: 'pow' was not declared in this scope
   19 |                 x += (1 / N)*(pow(0.5,a));
      |                               ^~~
Language: C++

#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<cstdio>
#include<cstdlib>
#include<string>
#include<iostream>
#include <iomanip>
#include<queue>
#include<algorithm>
#include <functional>
#include<vector>
using namespace std;

long double N;
int K;
long double ans = 0;

int main() {
	cin >> N >> K;
	int idx = 1;
	if (N < K) {
		for (int i = N; i > 0; i--) {
			while (i*pow(2, idx) < K) idx++;
			if (i*pow(2, idx) >= K) {
				ans += (1.0 / N)*pow(0.5, idx);
			}
		}
		cout << ans << endl;
	}
	else {
		for (int i = K - 1; i > 0; i--) {
			while (i*pow(2, idx) < K) idx++;
			if (i*pow(2, idx) >= K) {
				ans += (1.0 / N)*pow(0.5, idx);
			}
		}
		ans += (1.0 / N)*(N - K+1);
		cout << ans << endl;
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:23:34: error: 'pow' was not declared in this scope
   23 |                         while (i*pow(2, idx) < K) idx++;
      |                                  ^~~
a.cc:24:31: error: 'pow' was not declared in this scope
   24 |                         if (i*pow(2, idx) >= K) {
      |                               ^~~
a.cc:32:34: error: 'pow' was not declared in this scope
   32 |                         while (i*pow(2, idx) < K) idx++;
      |                                  ^~~
a.cc:33:31: error: 'pow' was not declared in this scope
   33 |                         if (i*pow(2, idx) >= K) {
      |                               ^~~
Language: C++

#include<iostream>
#include<algorithm>
#include<cstdlib>
#include<string>
#include<math>
using namespace std;
int main()
{
  double n, k;
  double ans=0;
  cin >> n >> k;
  if(n>=k){
    for(int i=0; i++; i<(n-k+1)) ans=ans+(1/n)*0.5^(ceil(log2(k/i)));
    ans=ans+(n-k+1)/n;
  }
  else{
    for(int i=0; i++; i<n) ans=ans+(1/n)*0.5^(ceil(log2(k/i)));
  }
  cout<<ans;
  return 0;
}

Compiler output:
a.cc:5:9: fatal error: math: No such file or directory
    5 | #include<math>
      |         ^~~~~~
compilation terminated.
Language: C++

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


int main (){



int i, j, N, K,count;
double kakuritu=0.0;

scanf("%d", &N);
scanf("%d", &K);

for(i=1; i<=N ; i++){
count=0;
j = i;
while(j < K){
j * =2;
count++;
}
kakuritu+=1.0/((double) N * pow(2,count));
}

printf("%.10lf\n",kakuritu);
return 0;

}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:5: error: expected primary-expression before '=' token
   19 | j * =2;
      |     ^
Language: C++

#include<iostream>
#include<sstream>
#include<vector>
#include<iterator>
#include<algorithm>
#include<iomanip>
using namespace std;

int main(void)
{
    int N, K;
    cin >> N >> K;

    vector<int> v;
    for (int i = 1; i <= N && i < K; i++) {
        int cnt = 0;
        while ((i << cnt) < K)
            cnt++;
        
        v.push_back(cnt);
    }

    sort(v.begin(), v.end());

    double ans = 0;
    for (int i = 0; i < (int)v.size(); i++)
        ans += 1.0 - pow(2.0, -v[i]);
    ans /= N;
    ans = 1.0 - ans;

    cout << fixed << setprecision(50) << ans << endl;

    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:27:22: error: 'pow' was not declared in this scope
   27 |         ans += 1.0 - pow(2.0, -v[i]);
      |                      ^~~
Language: C++

#include<cstdio>
#include<algorithm>
#include<iostream>
#include<queue>
#include<cstring>
using namespace std;
#define N 1010
#define ll long long
const ll mod =1e9+7;
double pow(double a,int k)
{
    double res=1;
    while(k)
    {
        if(k&1)
            res=res*a;
        a=a*a;
        k>>=1;
    }
    return res;
}
int main()
{

    double n,k,ans=0;
    cin>>n>>k;
    for(int i=1;i<=n;i++)
    {
        int b=(ceil)(log(k/i)/log(2));
        b=max(b,0);
        ans+=pow(0.5,b);
    }
    printf("%.12f\n",ans/n);
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:29:16: error: 'ceil' was not declared in this scope
   29 |         int b=(ceil)(log(k/i)/log(2));
      |                ^~~~
a.cc:29:22: error: 'log' was not declared in this scope; did you mean 'long'?
   29 |         int b=(ceil)(log(k/i)/log(2));
      |                      ^~~
      |                      long
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();
        int NN = N + 1;
        double res = 0;
        
        for(int i = 0; i < N ; i ++){
        double a = 1/N * Math.pow(0.5, NN - i);
        res += a;
        }
        
        System.out.println(a);
    }
}

Compiler output:
Main.java:18: error: cannot find symbol
        System.out.println(a);
                           ^
  symbol:   variable a
  location: class Main
1 error
Language: C++

#include<stdio.h>
#include<iostream>
#include<vector>
#include<utility>
#include<algorithm>
#include<map>

using namespace std;
using ll = long long int;

int n, k;

int main(void) {
	cin >> n >> k;
	long double ret = 0., tmp;
	for (int i = 1; i <= n; i++) {
		int win = ceil(log2(double(k) / i));
		tmp = pow(2, -1 * win);
		if (tmp > 1.)
			tmp = 1.;
		ret += tmp;
	}
	printf("%.20f\n", ret / n);
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:32: error: 'log2' was not declared in this scope
   17 |                 int win = ceil(log2(double(k) / i));
      |                                ^~~~
a.cc:17:27: error: 'ceil' was not declared in this scope
   17 |                 int win = ceil(log2(double(k) / i));
      |                           ^~~~
a.cc:18:23: error: 'pow' was not declared in this scope
   18 |                 tmp = pow(2, -1 * win);
      |                       ^~~
Language: Java

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = Integer.parseInt(sc.next());
		int k = Integer.parseInt(sc.next());
		double win = 0;
		for(int i=1;i<=n;i++) {
			int m=i;
			int j;
			for(j=1;m<k;j++) {
				m = m*2;
			}
			win = win + Math.pow(0.5, j-1);
		}
		win = win/n;

		System.out.println(win);
	}
}

Compiler output:
Main.java:3: error: cannot find symbol
		Scanner sc = new Scanner(System.in);
		^
  symbol:   class Scanner
  location: class Main
Main.java:3: error: cannot find symbol
		Scanner sc = new Scanner(System.in);
		                 ^
  symbol:   class Scanner
  location: class Main
2 errors
Language: C++

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

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

	vector<int> nums;
	double res = 0;
	if (n >= k) {
		 nums.push_back(n - k + 1);
	}
	else {
		nums.push_back(0);
	}
	int i, l, r;
	for (i = 1,  l = (k + 1) / 2, r = k; l != 1 ; ++i, r = l, l = (l + 1) / 2) {
		if (r > n) {
			cout << i << "(k): " << n - l << endl;
			if (l > n)continue;
			nums.push_back(n + 1 - l);
		}
		else {
			nums.push_back(r - l);
			cout << i << ": " << r - l << endl;
		}
	}
	nums.push_back(1);

	res = 0;
	for (auto it = nums.rbegin(); it != nums.rend(); ++it, --i) {
		res += pow(0.5, i) * *it;
	}

	cout << res / n << endl;

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:37:24: error: 'pow' was not declared in this scope
   37 |                 res += pow(0.5, i) * *it;
      |                        ^~~