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

#include <iostream>
#include <algorithm>
#include <set>
#include <numeric>
#include <vector>

using namespace std;


int main()
{
	int n;
	double k;

	cin >> n >> k;

	double sum = 0;
	for (int i = 1; i <= n; i++)
	{
		int p = (int)(-floor(log2(i / k )));
		if (p < 0)
		{
			p = 0;
		}
		sum += pow(0.5, p);
	}
	sum /= n;

	printf("%0.12lf\n", sum);

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:20:38: error: 'log2' was not declared in this scope
   20 |                 int p = (int)(-floor(log2(i / k )));
      |                                      ^~~~
a.cc:20:32: error: 'floor' was not declared in this scope
   20 |                 int p = (int)(-floor(log2(i / k )));
      |                                ^~~~~
a.cc:25:24: error: 'pow' was not declared in this scope
   25 |                 sum += pow(0.5, p);
      |                        ^~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int main(){
  int N,K;
  double sum;
  cin >> N >> K;
  for(i=0;i<N;i++){
    while(i<K){
      i*=2;
    }
    sum+=1/i;
  }
  cout << sum/N << endl;
}
    

Compiler output:
a.cc: In function 'int main()':
a.cc:8:7: error: 'i' was not declared in this scope
    8 |   for(i=0;i<N;i++){
      |       ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int main(){
  int N,K;
  double sum,x,xs;
  cin >> N >> K;
  for(i=0;i<N;i++){
    x=1;
    while(i<K){
      i*=2;
      x/=2;
      xs=x;
    }
    sum+=xs;
  }
  cout << sum/N << endl;
}
    

Compiler output:
a.cc: In function 'int main()':
a.cc:8:7: error: 'i' was not declared in this scope
    8 |   for(i=0;i<N;i++){
      |       ^
Language: C++

#include <limits>
using namespace std;

int main() {
    int n = 0, k = 0;
    float sumPos = 0.;

    cin >> n >> k;

    float dicePos = 1. / n;
    double coinPos = 1. / 2;

    int cnt = (k / 2) - 1;
    //cout << cnt << endl;

    for (int i = cnt; i >= 2 ; --i) {
        //cout << "coinPos: "<< coinPos << endl << " cnt is " << cnt << endl; 
        //cout << "std::pow is " << std::pow(coinPos, cnt)  << endl;
        float pow = std::pow(coinPos, i);

        //cout << "pow is " << pow << endl;
        //cout << "dicePos is " << dicePos << endl;
        float pos = dicePos * pow;

        //cout << "pos is " << pos << endl;
        //cout << "pos is " << pos << endl;
        sumPos += pos;
        //cout << "sumPos is " << sumPos << endl;
    }

    cout << std::setprecision(9) << sumPos << endl;

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:5: error: 'cin' was not declared in this scope
    8 |     cin >> n >> k;
      |     ^~~
a.cc:2:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    1 | #include <limits>
  +++ |+#include <iostream>
    2 | using namespace std;
a.cc:19:26: error: 'pow' is not a member of 'std'
   19 |         float pow = std::pow(coinPos, i);
      |                          ^~~
a.cc:31:5: error: 'cout' was not declared in this scope
   31 |     cout << std::setprecision(9) << sumPos << endl;
      |     ^~~~
a.cc:31:5: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:31:18: error: 'setprecision' is not a member of 'std'
   31 |     cout << std::setprecision(9) << sumPos << endl;
      |                  ^~~~~~~~~~~~
a.cc:2:1: note: 'std::setprecision' is defined in header '<iomanip>'; this is probably fixable by adding '#include <iomanip>'
    1 | #include <limits>
  +++ |+#include <iomanip>
    2 | using namespace std;
a.cc:31:47: error: 'endl' was not declared in this scope
   31 |     cout << std::setprecision(9) << sumPos << endl;
      |                                               ^~~~
a.cc:2:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
    1 | #include <limits>
  +++ |+#include <ostream>
    2 | using namespace std;
Language: C++

#include"bits/stdc++.h"
using namespace std;
int main(){
    long long N, K;
    cin >> N >> K;
    double answer = 0;
    for(int i=0; i<N; i++){
        long long score = i+1;
        double tmp = 1;
        while(score < K){
            tmp /= 2;
            score *= 2;
        }
        anser += tmp;
    }
    cout << setprecision(16) << answer << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:9: error: 'anser' was not declared in this scope; did you mean 'answer'?
   14 |         anser += tmp;
      |         ^~~~~
      |         answer
Language: C++

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

int main() {
  int N, K,
  cin >> N >> K;
  double win_rate = 0;
  if (N >= K) {
    cout << 1.0 << endl;
    return 0;
  }
  for (n=1; n<=N; n++) {
    int cnt = 0;
    for (i=1; i<=n; i++) {
      cnt ++;
      if (2 * i * N >= K) break;
    }
    win_rate += (1/N) * pow(0.5, cnt);
  }
  cout << setprecision(12) << win_rate << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:6:7: error: expected initializer before '>>' token
    6 |   cin >> N >> K;
      |       ^~
a.cc:12:8: error: 'n' was not declared in this scope
   12 |   for (n=1; n<=N; n++) {
      |        ^
a.cc:14:10: error: 'i' was not declared in this scope
   14 |     for (i=1; i<=n; i++) {
      |          ^
Language: C++

#include <bits/stdc++.h>
#define itn int
#define rep(i, n) for (int i = 0; i < n; i++)

using namespace std;
typedef long long ll;


int main(){
    int n,k;
    cin >> n >> k;
    double ret=0;
    rep(i,n){
        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:16:19: error: 'b' was not declared in this scope
   16 |         while(now<b){
      |                   ^
Language: C++

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repr(i, n) for(int i = ((int)(n) - 1); i >= 0; i--)
#define repn(i, n) for(int i = 1; i <= (int)(n); i++)
#define reprn(i, n) for(int i = ((int)(n)); i > 0; i--)
#define all(x) (x).begin(), (x).end()
#define LARGE_PRIME_NUM 1000000007
typedef long long ll;

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

using namespace std;

int getReq(int i, int k) {
	if (i == 0) {
		return 0;
	}
	int ans = 0;
	int i0 = i;
	while (i0 < k) {
		i0 *= 2;
		ans++;
	}
	return ans;
}

int main() {
	int n, k;
	cin >> n >> k;
	double ans = 0;
	rep(i, n) {
		int r = getReq(i + 1, k);
		ans += 1.0 / n * pow(0.5, r);
	}
	cout << std::setprecision(12) << ans << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:38:34: error: 'pow' was not declared in this scope
   38 |                 ans += 1.0 / n * pow(0.5, r);
      |                                  ^~~
Language: C++

#include <cstdio>
using namespace std;
int main() {
	int n , k;
  	scanf("%d %d", &n, &k);
  	double ans = 0., aux;
  	for (int i = 1, j; i<=n; ++i) {
    	j = i;
      	aux = 1.
      	while (j <= k-1) {
        	aux /= 0.5
            j<<=1;
        }
      	ans += aux;
    }
  	printf("%.12lf\n", ans/n);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:17: error: expected ';' before 'while'
    9 |         aux = 1.
      |                 ^
      |                 ;
   10 |         while (j <= k-1) {
      |         ~~~~~
Language: C++

#include <cmath>
#include <iostream>
 
using namespace std;
 
int main(){
	int n, k;
	cin >> n >> k;
 
	double prob = 0.0;
 
	if(n < k){
		for(int i = 1; i <= n; ++i){
			prob += 1.0/double(n) * pow(double(0.5), ceil(log(k/i)/log(2.0)));
		}	
	}else{
		prob += double(n-k+1) / double(n);
 
		for(int i = 1; i <= k-1; ++i){
			prob += 1.0/double(n) * pow(double(0.5), ceil(log(k/i)/log(2.0)));
		}
	}
 
	cout << setprecision(20) << prob << endl;
 
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:24:17: error: 'setprecision' was not declared in this scope
   24 |         cout << setprecision(20) << prob << endl;
      |                 ^~~~~~~~~~~~
a.cc:3:1: note: 'std::setprecision' is defined in header '<iomanip>'; this is probably fixable by adding '#include <iomanip>'
    2 | #include <iostream>
  +++ |+#include <iomanip>
    3 |
Language: C++

#include<bits\stdc++.h>
#include<stdio.h>
#include<string.h>
#include<math.h>
using namespace std ;
int main()
{
    int n ,k ,i=1;
     double a,b,c;
    cin >> n >> k ;
    a = 1/(double)n  ;

    for(int i=1;i<=n;i++)
    {
        int x=0,p=i;
        while(p<=k)
        {
            p*=2;
            x++;
        }
        b += a*(pow(.5,x));
    }
    cout << setprecision(11)  << b << endl;
}


Compiler output:
a.cc:1:9: 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;

int main(){
  double N, K;
  double sum = 0;
  cin >> N >> K;
  for(int i = 1; i <= N; i++){
    int x = 0;//指数
    int y = i;
    bool a = true;
    while(a){
      if(y < K){
        y *= 2;
        x++;
      }
      else{
        a = false;
        sum += (1.0/N)*(pow((1/2), x);
      }
    }
  }
  cout << sum << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:19:38: error: expected ')' before ';' token
   19 |         sum += (1.0/N)*(pow((1/2), x);
      |                        ~             ^
      |                                      )
Language: C++

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

int main(){
  double N, K;
  double sum = 0;
  cin >> N >> K;
  for(int i = 1; i <= N; i++){
    int x = 0;//指数
    int y = i;
    bool a = true;
    while(a){
      if(y < K){
        y *= 2;
        x++;
      }
      else{
        a = false;
        sum += (1.0/N)*((1.0/2.0)^x);
      }
    }
  }
  cout << sum << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:19:34: error: invalid operands of types 'double' and 'int' to binary 'operator^'
   19 |         sum += (1.0/N)*((1.0/2.0)^x);
      |                         ~~~~~~~~~^~
      |                             |     |
      |                             |     int
      |                             double
Language: Java

import java.util.Scanner;

public class Main {
	public static void main (String[] args) {
    	try (Scanner sc = new Scanner(System.in)) {
        	int n = sc.nextInt();
          	int k = sc.nextInt();
			double ans = (1/(n * (k - 1)* (k - 1))* ((1/(k - 1)^2) + (1/ (k -1) + 1);
            System.out.println(ans);
        }
    }
}

Compiler output:
Main.java:8: error: ')' expected
			double ans = (1/(n * (k - 1)* (k - 1))* ((1/(k - 1)^2) + (1/ (k -1) + 1);
			                                                                        ^
1 error
Language: C++

#include<iostream>
#include<algorithm>
using namespace std;
typedef long long llong;

int N, K;
double ans = 0;

int main()
{
	cin >> N >> K;
	for (int i = 1; i <= N; i++)
	{
		int f = ceil((double)K / i);
		double a = 1;
		int b = 1;
		for (;;)
		{
			if (f <= b)
			{
				ans += a / N;
				break;
			}

			else
			{
				a /= 2;
				b *= 2;
			}
		}
	}

	cout << ans;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:25: error: 'ceil' was not declared in this scope
   14 |                 int f = ceil((double)K / i);
      |                         ^~~~
Language: C++

import java.util.Scanner;

public class DiceAndCoin {
	
	public static void main(String[] args){
		
		Scanner scanner = new Scanner(System.in);
		//サイコロの面の数
		int N = scanner.nextInt();
		//勝ち得点
		int K = scanner.nextInt();
		//サイコロを振る数
		int count;
		//各サイコロの目のときの確率
		double p = 0;
		//答え
		double answer = 0;
		
		//サイコロの目でループ
		for(int i = 1; i <= N; i++){
			count = i;
			p = 1.0/N;
				//サイコロの目が勝ち得点を超えるまでループ
				while(count < K){
					count *= 2;
					p /= 2.0;
				}
				answer += p;
		}
		System.out.println(answer);
	}
}

Compiler output:
a.cc:1:1: error: 'import' does not name a type
    1 | import java.util.Scanner;
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:3:1: error: expected unqualified-id before 'public'
    3 | public class DiceAndCoin {
      | ^~~~~~
Language: C

#include <stdio.h>
24.#include <stdlib.h>
25.#include <math.h>
26. 
27.int main(void){
28.    double n, k;
29.    scanf("%lf %lf", &n, &k);
30.    long double p = 0;
31.    double i = n;
32.    double j = 0.0;
33.    while(i > 0){
34.        if(pow(2, j) * i >= k){
35.            p += pow(0.5, j);
36.            i-=1.0;
37.        }else{
38.            j+=1.0;
39.        }
40.    }
41.    printf("%.12Lf\n", p/n);
42.    return 0;
43.}


Compiler output:
main.c:2:1: error: expected identifier or '(' before numeric constant
    2 | 24.#include <stdlib.h>
      | ^~~
main.c:2:4: error: stray '#' in program
    2 | 24.#include <stdlib.h>
      |    ^
main.c:3:4: error: stray '#' in program
    3 | 25.#include <math.h>
      |    ^
main.c:5:1: error: invalid suffix "int" on floating constant
    5 | 27.int main(void){
      | ^~~~~~
Language: C

#include <stdio.h>
2.#include <stdlib.h>
3.#include <math.h>
4. 
5.int main(void){
6.    double n, k;
7.    scanf("%lf %lf", &n, &k);
8.    long double p = 0;
9.    double i = n;
10.    double j = 0.0;
11.    while(i > 0){
12.        if(pow(2, j) * i >= k){
13.            p += pow(0.5, j);
14.            i-=1.0;
15.        }else{
16.            j+=1.0;
17.        }
18.    }
19.    printf("%.12Lf\n", p/n);
20.    return 0;
21.}

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

int main(void){
    double n, k;
    scanf("%lf %lf", &n, &k);
    long double p = 0;
    double i = n;
    double j = 0.0;
    while(i > 0){
        if(pow(2, j) * i >= k){
            p += pow(0.5, j);
            i-=1.0;
        }else{
            j+=1.0;
        }
    }
    printf("%.12Lf\n", p/n);
    return 0;
}

Compiler output:
main.c:2:1: error: expected identifier or '(' before numeric constant
    2 | 2.#include <stdlib.h>
      | ^~
main.c:2:3: error: stray '#' in program
    2 | 2.#include <stdlib.h>
      |   ^
main.c:3:3: error: stray '#' in program
    3 | 3.#include <math.h>
      |   ^
main.c:5:1: error: invalid suffix "int" on floating constant
    5 | 5.int main(void){
      | ^~~~~
Language: C

#include <stdio.h>
int main(void){
    int a,b,i,j;
    double c=0,k=0;

scanf("%d %d",&a,&b);
for(i=1;i<=a;i++){
    c=1.0/a;
    j=i;
    while(j<b){
        j+=2;
        c/=2
    }
    k+=c;
}
printf("%.12d",k);
return 0;
}


Compiler output:
main.c: In function 'main':
main.c:12:13: error: expected ';' before '}' token
   12 |         c/=2
      |             ^
      |             ;
   13 |     }
      |     ~
Language: C++

#include <stdio.h>
#include <math.h>
c[100001]={};
int main()
{
    int a,b,d=0,e,f;
    double k=0;
    scanf("%d%d",&a,&b);
    for(e=1; e<=a; ++e)
    {
        f=b;
        d=0;
        while(f>=e)
        {
            f/=2;
            d++;
        }
        c[e]=d;
    }
    for(e=1; e<=a; ++e)
    {
        k+=pow(0.5,c[e]);
    }
    k/=a;
    printf("%.12lf",k);
}


Compiler output:
a.cc:3:1: error: 'c' does not name a type
    3 | c[100001]={};
      | ^
a.cc: In function 'int main()':
a.cc:18:9: error: 'c' was not declared in this scope
   18 |         c[e]=d;
      |         ^
a.cc:22:20: error: 'c' was not declared in this scope
   22 |         k+=pow(0.5,c[e]);
      |                    ^
Language: C++

import sys

n=input()
num = n.split()
a=int(num[0])
b=int(num[1])

def checkMultiNum(base, dst):
	num=0
	while True:
		if base >= dst:
			break;
		num+=1
		base = base * 2
		if base >= dst:
			break;
	return num

prob=1/a
res=0
for v in range(a):
	num = checkMultiNum(v+1, b)
	tmp = prob * 0.5**num
	res += tmp

print(res)

Compiler output:
a.cc:1:1: error: 'import' does not name a type
    1 | import sys
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:13:17: error: 'num' does not name a type; did you mean 'enum'?
   13 |                 num+=1
      |                 ^~~
      |                 enum
a.cc:17:9: error: expected unqualified-id before 'return'
   17 |         return num
      |         ^~~~~~
Language: C++

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

int main()
{
  int N,K;
  cin>>N>>K;
  double s=0;
  for(int i=1;i<N+1;i++)
  {
    double ss=1;
    int b=i;
    while(b<K)
    {
      ss/=2;
      b*=2
    }
    s+=ss;
  }
  s/=3;
  cout<<fixed<<setprecision(10)<<s<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:11: error: expected ';' before '}' token
   16 |       b*=2
      |           ^
      |           ;
   17 |     }
      |     ~
Language: C++

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

int main()
{
  int N;K;
  cin>>N>>K;
  double s=0;
  for(int i=1;i<N=1;i++)
  {
    double ss=1;
    int b=i;
    while(b<K)
    {
      ss/=2;
      b*=2
    }
    s+=ss;
  }
  s/=3;
  cout<<fixed<<setprecision(10)<<s<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:9: error: 'K' was not declared in this scope
    6 |   int N;K;
      |         ^
a.cc:9:16: error: lvalue required as left operand of assignment
    9 |   for(int i=1;i<N=1;i++)
      |               ~^~
a.cc:16:11: error: expected ';' before '}' token
   16 |       b*=2
      |           ^
      |           ;
   17 |     }
      |     ~
Language: C++

#include<iostream>
#include<vector>

using namespace std;

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

    

    

       
    


Compiler output:
a.cc: In function 'int main()':
a.cc:11:5: error: 'point' was not declared in this scope
   11 |     point=i;
      |     ^~~~~
Language: C++

#include<iostream>
#include<vector>

using namespace std;

int main(){
int n,k;cin>>n>>k;
  int p=1,total=0,ans=0;
  for(int i=0;i<n;i++)
  {
    if(total<k)
    {
      p=p/2;
      tatal=tatal*2;
    }
    ans+=p/n;
  }
  cout<<ans<<endl;
}

    

    

       
    


Compiler output:
a.cc: In function 'int main()':
a.cc:14:7: error: 'tatal' was not declared in this scope; did you mean 'total'?
   14 |       tatal=tatal*2;
      |       ^~~~~
      |       total
Language: C++

#include <iostream>

using namespace std;

int main() {
	int N, K;
	cin >> N >> K;
	double p = 0.0;
	
	for (int i = 1; i <= N; i++) {
		int cnt = 0;
		int tmp = i;
		while (tmp < K) {
			tmp *= 2;
			cnt++;
		}
		p += 1.0 / N * (1.0 / pow(2, cnt));
	}
	printf("%0.12lf\n", p);

	int s;
	cin >> s;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:39: error: 'pow' was not declared in this scope
   17 |                 p += 1.0 / N * (1.0 / pow(2, cnt));
      |                                       ^~~
Language: C++

using namespace std;

int main(){
    int n,k,now;
    double ans = 0.0;
    double one_n,temp;
    cin >> n >> k;
    one_n = 1.0 / n;

    for (int i = 1; i <= n; i++) {
        now = i;
        temp = one_n;
        while ( now < k ) {
            now *= 2.0;
            temp /= 2.0;
        }
        ans += temp;
    }

    cout << setprecision(15) << ans << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:5: error: 'cin' was not declared in this scope
    7 |     cin >> n >> k;
      |     ^~~
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:20:5: error: 'cout' was not declared in this scope
   20 |     cout << setprecision(15) << ans << endl;
      |     ^~~~
a.cc:20:5: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:20:13: error: 'setprecision' was not declared in this scope
   20 |     cout << setprecision(15) << ans << endl;
      |             ^~~~~~~~~~~~
a.cc:1:1: note: 'std::setprecision' is defined in header '<iomanip>'; this is probably fixable by adding '#include <iomanip>'
  +++ |+#include <iomanip>
    1 | using namespace std;
a.cc:20:40: error: 'endl' was not declared in this scope
   20 |     cout << setprecision(15) << ans << 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<iomanip>
using namespace std;

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

Compiler output:
a.cc: In function 'int main()':
a.cc:22:42: error: 'pow' was not declared in this scope
   22 |                 ans += ((double)1 / N) * pow((double)1 / 2, cnt);
      |                                          ^~~
Language: C++

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

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

Compiler output:
a.cc: In function 'int main()':
a.cc:22:40: error: 'pow' was not declared in this scope
   22 |                 ans += ((double)1 / N)*pow((double)1 / 2, cnt);
      |                                        ^~~
Language: C++

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

int main(){
  int n,k; cin>>n >>k;
  double ans = 0;
  if(int i=1;i<=n;i++){
    double p = 1;
    int x = i;
    while(x < k){
      p *= 0.5;
      x *= 2;
    }
    ans += p/n;
  }
  printf("%.11f\n",ans);
}
    

Compiler output:
a.cc: In function 'int main()':
a.cc:7:18: error: expected ')' before ';' token
    7 |   if(int i=1;i<=n;i++){
      |     ~            ^
      |                  )
a.cc:7:19: error: 'i' was not declared in this scope
    7 |   if(int i=1;i<=n;i++){
      |                   ^
Language: C++

#include "bits/stdc++.h"
using namespace std;
int main(){

  
  int N ,K;
  cin>>N>>K;
  double ans=0;
  for (int i=1;i<=N;i++){
      double tmp=1;
      int now=i;
      while(now<K){
          now*=2;
          tmp*=0.5;
      }
      ans+=tmp;

  }setprecision
  ans/=N;
  cout <<fixed<<setprecision(10)<<ans<<endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:18:16: error: expected ';' before 'ans'
   18 |   }setprecision
      |                ^
      |                ;
   19 |   ans/=N;
      |   ~~~
Language: C++

#include "bits/stdc++.h"
using namespace std;
int main(){  
  int N ,K;
  cin>>N>>K;
  double ans=0;
  for (int i=1;i<=N;i++){
      double tmp=1;
      int now=i;
      while(now<K){
          now*=2;
          tmp*=0.5;
      }
      ans+=tmp;

  }
  ans/=tmp;
  cout <<ans<<endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:17:8: error: 'tmp' was not declared in this scope; did you mean 'tm'?
   17 |   ans/=tmp;
      |        ^~~
      |        tm
Language: C++

#include <bits/stdc++.h>
#include<math.h>
using namespace std;
int main()
{
    int N, K, d;
    double a, c = 0;
    cin >> N >> K;
    for (int n = 1; n <= N; n++)
    {
        for (int b = 0;; b++)
        {
            d = n * pow(b, 2);
            if (d > K)
            {
                a = 1.0 / (N * pow(2,));
                cout << a << pow(2, b) << endl;
                break;
            }
        }
        c = c + a;
    }
    cout << c << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:38: error: expected primary-expression before ')' token
   16 |                 a = 1.0 / (N * pow(2,));
      |                                      ^
Language: C++

#include<iostream>
#include<sstream>
#include<vector>
#include<algorithm>
#include<string>
#include<stdexcept>
#include<stdio.h>
#include<queue>
#include <cmath>
//for(int i=0;i<n;i++)
#define cinf(n,x) for(int i=0;i<n;i++) cin >> x[i];
#define pi pair<int,int> 
using namespace std;
using ll = long long;
 int main(){
    int n,k; cin >> n >> k;
    double sum=0;
    for(int i=1;i<=n;i++){
        int t=0;
        while(k>i*pow(2,t)){
            t++;
        }
        sum+=1.0/(n*pow(2,t));
    }
    
  printf("%.12f\n",ret);
 }

Compiler output:
a.cc: In function 'int main()':
a.cc:26:20: error: 'ret' was not declared in this scope
   26 |   printf("%.12f\n",ret);
      |                    ^~~
Language: C++

#include <iostream>
using namespace std;
int main(void){
    int n,k;
    cin >> n >> k;
    double ans = 0;
    for(int i = 1;i <= n;i++){
        int temp = i;
        double rate = 1 / n;
        while(temp < k){
            temp *= 2;
            rate /= 2;
        }
        ans += rate;
    }
    cout << ans << setprecision(12) << endl;
}


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

#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#define speed ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define ll long long
#define eps 1e-8
#define inf INT_MAX
#define mod 1000000009
using namespace std;

int main() {
	speed;
	int n, k;
	cin >> n >> k;
	double ans = 0, v = 1.0/n;
	for (int i = 1; i <= n; ++i) {
		int mn = 0, j = i;
		while (j < k)
			j *= 2, ++mn;
		ans += v * 1/pow(2, mn);
	}
	cout.precision(12);
	cout << fixed << ans << '\n';
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:25:30: error: 'pow' was not declared in this scope
   25 |                 ans += v * 1/pow(2, mn);
      |                              ^~~
Language: C++

import math 

n, k = map(int , input().split())

prob=0

for i in range(1, n+1):
    po = math.ceil(math.log2(max(1, k/i)))
    prob += math.pow(1/2, po)*(1/n)
    
print(prob)

Compiler output:
a.cc:1:1: error: 'import' does not name a type
    1 | import math
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
Language: C++

import math


import math


def main():
    N, K = map(int, input().split())
    ans = 0
    for i in range(N): 
        tmp = K / (i+1)
        a = math.log2(tmp)
        if a < 0:
            a = 0
        elif not a.is_integer():
            a = int(a) + 1
        '''
        if tmp.is_integer():
            tmp = int(tmp)
            if not (tmp and ):
                a = int(math.log2(tmp))
        else:
            a = int(math.log2(tmp)) + 1
        '''
        ans += 0.5 ** a
    ans /= N

    print('{:.15f}'.format(ans))


main()
    


Compiler output:
a.cc:17:9: error: empty character constant
   17 |         '''
      |         ^~
a.cc:17:11: warning: missing terminating ' character
   17 |         '''
      |           ^
a.cc:17:11: error: missing terminating ' character
a.cc:24:9: error: empty character constant
   24 |         '''
      |         ^~
a.cc:24:11: warning: missing terminating ' character
   24 |         '''
      |           ^
a.cc:24:11: error: missing terminating ' character
a.cc:28:11: warning: multi-character literal with 7 characters exceeds 'int' size of 4 bytes
   28 |     print('{:.15f}'.format(ans))
      |           ^~~~~~~~~
a.cc:1:1: error: 'import' does not name a type
    1 | import math
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
Language: C++

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

int main() {
 int N,K: cin >> N >> K;
 long double sum = 0;
 for(int i=0;i<N;i++){
   long double kaku = 1.0/N;
   int now = i;
   while(K > now){
     now *= 2;
     kaku /= 2;
   }
   sum += kaku;
 }
  cout << sum << endl;
}
   
     
     
       
       
       
       
 

Compiler output:
a.cc: In function 'int main()':
a.cc:5:9: error: found ':' in nested-name-specifier, expected '::'
    5 |  int N,K: cin >> N >> K;
      |         ^
      |         ::
a.cc:5:8: error: 'K' has not been declared
    5 |  int N,K: cin >> N >> K;
      |        ^
a.cc:5:15: error: qualified-id in declaration before '>>' token
    5 |  int N,K: cin >> N >> K;
      |               ^~
a.cc:10:10: error: 'K' was not declared in this scope
   10 |    while(K > now){
      |          ^
Language: C++

#include<stdc++.h>
using namespace std;
int main(){
  int n,k;
  cin >> n >> k;
  double tmp;
  int now;
  double answer=0;
  for (int i=1; i<=n; i++){
    now = i;
    tmp = 1.0 / n;
    while (now >= k){
      now *= 2;
      tmp /= 2;
    }
    answer += tmp;
  }
  cout << answer << endl;
}

Compiler output:
a.cc:1:9: fatal error: stdc++.h: No such file or directory
    1 | #include<stdc++.h>
      |         ^~~~~~~~~~
compilation terminated.
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;
    for(int i = 1; i <= N; i++){
        double prob = 1.0/N;
        for(int k = i; k < K; k = k * 2){
            prob = prob / 2;
        }
        ans += prob;
    }
    cout << setprecition(11) << ans << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:34:13: error: 'setprecition' was not declared in this scope
   34 |     cout << setprecition(11) << ans << endl;
      |             ^~~~~~~~~~~~
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;
    for(int i = 1; i <= N; i++){
        double prob = 1.0/N;
        for(k = i; k < K; k = k * 2){
            prob = prob / 2;
        }
        ans += prob;
    }
    cout << setprecition(11) << ans << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:29:13: error: 'k' was not declared in this scope
   29 |         for(k = i; k < K; k = k * 2){
      |             ^
a.cc:34:13: error: 'setprecition' was not declared in this scope
   34 |     cout << setprecition(11) << ans << endl;
      |             ^~~~~~~~~~~~
Language: C++


#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <cstdlib>
#include <utility>
#include <cstdio>
#include <vector>
#include <string>
#include <queue>
#include <stack>
#include <cmath>
#include <set>
#include <map>

using ll = long long;
using itn = int;
using namespace std;


int main() {
	int n, k;
	cin >> n>> k;
	double x = (n - k + 1) / n;
	for (int i = 1; i < k; i++) {
		for (int j = 1; j < k; j++) {
			if (k <= i*pow(2, j)) {
				x = x + pow(0.5, j)
				break;
			}
			else j++;
		}
		return 0;
	}
	printf(%.10lf, x);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:29:52: error: expected ';' before 'break'
   29 |                                 x = x + pow(0.5, j)
      |                                                    ^
      |                                                    ;
   30 |                                 break;
      |                                 ~~~~~               
a.cc:36:16: error: expected primary-expression before '%' token
   36 |         printf(%.10lf, x);
      |                ^
a.cc:36:17: error: unable to find numeric literal operator 'operator""lf'
   36 |         printf(%.10lf, x);
      |                 ^~~~~
Language: C++

#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <cstdlib>
#include <utility>
#include <cstdio>
#include <vector>
#include <string>
#include <queue>
#include <stack>
#include <cmath>
#include <set>
#include <map>

using ll = long long;
using itn = int;
using namespace std;


int main() {
	int n, k;
	cin >> n>> k;
	double x = (n - k + 1) / n;
	for (int i = 1; i < k; i++) {
		for (int j = 1; j < k; j++) {
			if (k <= i*pow(2, j)) {
				x = x + pow(0.5, j)
			}
		}
		return 0;
	}
	cout << x <<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:28:52: error: expected ';' before '}' token
   28 |                                 x = x + pow(0.5, j)
      |                                                    ^
      |                                                    ;
   29 |                         }
      |                         ~
Language: C++

#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <cstdlib>
#include <utility>
#include <cstdio>
#include <vector>
#include <string>
#include <queue>
#include <stack>
#include <cmath>
#include <set>
#include <map>

using ll = long long;
using itn = int;
using namespace std;


int main() {
	int n, k;
	cin >> n>> k;
	double x = (n - k + 1) / n;
	for (int i = 1; i < k; i++) {
		for (int j = 1; j++) {
			if (k <= i * pow(2, j) {
				x = x + pow(0.5, j);
				break;
			}
		}
		return 0;
	}
	cout << x <<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:26:36: error: expected ';' before ')' token
   26 |                 for (int j = 1; j++) {
      |                                    ^
      |                                    ;
a.cc:27:47: error: expected ')' before '{' token
   27 |                         if (k <= i * pow(2, j) {
      |                            ~                  ^~
      |                                               )
a.cc:31:17: error: expected primary-expression before '}' token
   31 |                 }
      |                 ^
Language: C++


#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <cstdlib>
#include <utility>
#include <cstdio>
#include <vector>
#include <string>
#include <queue>
#include <stack>
#include <cmath>
#include <set>
#include <map>

using ll = long long;
using itn = int;
using namespace std;


int main() {
	int n, k;
	cin >> n>> k;
	double x = (k - 1) / n;
	for (int i = 1; i < k; i++) {
		for (int j = 1; j++) {
			if (k <= i * pow(2, j) {
				x = x + pow(1 / 2, j);
					break;
			}
		}
		return 0;
	}
	cout << x <<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:27:36: error: expected ';' before ')' token
   27 |                 for (int j = 1; j++) {
      |                                    ^
      |                                    ;
a.cc:28:47: error: expected ')' before '{' token
   28 |                         if (k <= i * pow(2, j) {
      |                            ~                  ^~
      |                                               )
a.cc:32:17: error: expected primary-expression before '}' token
   32 |                 }
      |                 ^
Language: C++

#include <iostream>
using namespace std;
int main(void){
  double N,K;
  cin >> N >> K;
  
  double ans = 0;
  
  for(int i=1;i<K,i++){
    int count = 0;
    double rate = 1.0;
    while(i < K){
      i *= 2;
      count++;
    }
    for(int j=0;j<i,j++){
      rate /= 2;
    }
    ans += 1 / N * rate;
  }
  
  cout << 1 - ans << endl;
  
  return 0;
}

    
    

Compiler output:
a.cc: In function 'int main()':
a.cc:9:22: error: expected ';' before ')' token
    9 |   for(int i=1;i<K,i++){
      |                      ^
      |                      ;
a.cc:16:24: error: expected ';' before ')' token
   16 |     for(int j=0;j<i,j++){
      |                        ^
      |                        ;
Language: C++

#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <functional>
#include <vector>
#define nummax 110000
using namespace std;

int main() {
	double ans = 0.0, y, i, N, K, x;
	cin >> N >> K;
	for (i = 1; i <= N; i++)
	{
		x = 0;
		while (1)
		{
			if (i * pow(2, (double)x) >= K)
				break;
			x++;
		}
		x *= -1;
		y = pow(2, (double)x);
		ans += y;
	}
	ans /= N;
	//cout << ans << endl;
	cout << fixed << setprecision(9) << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:28:26: error: 'setprecision' was not declared in this scope
   28 |         cout << fixed << setprecision(9) << ans << endl;
      |                          ^~~~~~~~~~~~
a.cc:6:1: note: 'std::setprecision' is defined in header '<iomanip>'; this is probably fixable by adding '#include <iomanip>'
    5 | #include <functional>
  +++ |+#include <iomanip>
    6 | #include <vector>
Language: C++

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

int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout << fixed << setprecision(15);
  
  int N, K, cnt = 0;
  cin >> N >> K;
  double ans = 0.0, p = 1.0;
  for (int n = N; n > 0; --n) {
    while (n*(1<<cnt) < K) {
      ++cnt;
      p *= 0.5;
    }
  	ans += p;
  }
  cout << ans/N << "\n";

Compiler output:
a.cc: In function 'int main()':
a.cc:19:25: error: expected '}' at end of input
   19 |   cout << ans/N << "\n";
      |                         ^
a.cc:4:12: note: to match this '{'
    4 | int main() {
      |            ^
Language: Java

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

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

    cin >> n;
    cin >> k;

    double sumN = 0.;

    for (int i = 1; i <= n ; ++i) {
        double diceP = 1.0 /n;

        int cnt = 1;
        for (int j = i; j < k ; j*=2) {
            cnt *= 2;
        }

        sumN += (diceP * (1.0/ cnt));
    }

    cout << sumN << endl;

    return 0;
}

Compiler output:
Main.java:1: error: illegal character: '#'
#include <iostream>
^
Main.java:2: error: illegal character: '#'
#include <string>
^
Main.java:3: error: illegal character: '#'
#include <iomanip>
^
Main.java:4: error: illegal character: '#'
#include <random>
^
Main.java:10: error: not a statement
    cin >> n;
        ^
Main.java:11: error: not a statement
    cin >> k;
        ^
Main.java:26: error: not a statement
    cout << sumN << endl;
                 ^
Main.java:7: error: unnamed classes are a preview feature and are disabled by default.
int main() {
^
  (use --enable-preview to enable unnamed classes)
8 errors
Language: C

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

int kiriage( double x )
{
    return (int)( x < 0.0 ? x : x+0.9 );
}

int main(){
  int i,j,k;
  long double ans=0.0;
  long double N,K;
  scanf("%lf %lf",&N,&K);

  for(i=1;i<=N;i++){
    k = kiriage(logl(K/i))/logl(2.0));
    if(i < (int)K){
    ans += (1.0/N) * powl(0.5000000,k);
    }
    else
    ans += (1.0/N);
  }
  
  printf("%.16lf\n",ans);
  return 0;
}




Compiler output:
main.c: In function 'main':
main.c:16:37: error: expected ';' before ')' token
   16 |     k = kiriage(logl(K/i))/logl(2.0));
      |                                     ^
      |                                     ;
main.c:16:37: error: expected statement before ')' token
Language: C++

include <bits/stdc++.h>
using namespace std;
using ll=long long;
int main(){
   ll n,k;
   cin>>n>>k;
   int score=0,p1=1;
   double p=0;
   for(int i=1;i<n+1;i++){
       score=i;
       p1=1;
       while(score<k-1){
           //cout<<score<<endl;
           score=score*2;
           p1=p1*2;
       }
       //p=+1000000000/(n*p1);
       cout<<n*p1<<endl;
   }
   cout<<p<<endl;
}

Compiler output:
a.cc:1:1: error: 'include' does not name a type
    1 | include <bits/stdc++.h>
      | ^~~~~~~
a.cc: In function 'int main()':
a.cc:6:4: error: 'cin' was not declared in this scope
    6 |    cin>>n>>k;
      |    ^~~
a.cc:18:8: error: 'cout' was not declared in this scope
   18 |        cout<<n*p1<<endl;
      |        ^~~~
a.cc:18:20: error: 'endl' was not declared in this scope
   18 |        cout<<n*p1<<endl;
      |                    ^~~~
a.cc:20:4: error: 'cout' was not declared in this scope
   20 |    cout<<p<<endl;
      |    ^~~~
a.cc:20:13: error: 'endl' was not declared in this scope
   20 |    cout<<p<<endl;
      |             ^~~~
Language: C++

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

int main(){
    int a,b;scanf("%d%d",&a,&b);
    double ret=0;
    for(int i=1;i<=a;i++){
        double tmp=1.0/a;
        int now=i;
        while(now<b){
            now*=2;
            tmp/=2;
        }
        ret+=tmp;
    }
    printf("%.12f\n",ret);
}

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;

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 << setprecision(10) << 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<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, b = 0;
		while (a < k) {
			a = a * 2;
			b++;
		}
		ans += 1 / (n * pow(2, b));
	}
	cout << ans << endl;
	return 0;
}


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

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i, n) for (ll i = 0; i < (ll)n; i++)

int main(){
  int N, K;
  cin >> N >> K;
  
  for(int i=1; i<=N; i++){
    double tmp = 1.0/(double)i;
    while(now<K){
      now *= 2;
      tmp /= 2;
    }
    ans += tmp;
  }

  cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:12:11: error: 'now' was not declared in this scope; did you mean 'pow'?
   12 |     while(now<K){
      |           ^~~
      |           pow
a.cc:16:5: error: 'ans' was not declared in this scope; did you mean 'abs'?
   16 |     ans += tmp;
      |     ^~~
      |     abs
a.cc:19:11: error: 'ans' was not declared in this scope; did you mean 'abs'?
   19 |   cout << ans << endl;
      |           ^~~
      |           abs
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, b = 0;
		while (a < k) {
			a = a * 2;
			b++;
		}
		ans += 1 / (n * pow(2, b));
	}
	cout << ans << endl;
	return 0;
}

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

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

int kiriage( double x )
{
    return (int)( x < 0.0 ? x : x+0.9 );
}

int main(){
  int i,j,k;
  long double ans=0.0;
  long double N,K;
  scanf("%lf %lf",&N,&K);

  for(i=1;i<=N;i++){
    k = kiriage(logl(K/i))/logl(2.0)));
    if(i < (int)K){
    ans += (1.0/N) * powl(0.5000000,k);
    }
    else
    ans += (1.0/N);
  }
  
  printf("%.16lf\n",ans);
  return 0;
}




Compiler output:
main.c: In function 'main':
main.c:16:37: error: expected ';' before ')' token
   16 |     k = kiriage(logl(K/i))/logl(2.0)));
      |                                     ^
      |                                     ;
main.c:16:37: error: expected statement before ')' token
main.c:16:38: error: expected statement before ')' token
   16 |     k = kiriage(logl(K/i))/logl(2.0)));
      |                                      ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main(){
  int n , k;
  double ans = 0;
  cin>>n>>k;
  double dice;
  double coin;

  for(int i = 1; i <= n; i++ ){
    int j = 1;
    int temp;
    temp = i;
    while(k > temp){
      temp *= 2;
      j *= 2;
    }
    double dice = n;
    double coin = j;
    ans += (1.00000000000/dice)*(1.00000000000/coin);
    //cout<<"i ="<<i<<", dice = "<<dice<<", coin = "<<coin<<", ans = "<<ans<<endl;
  }
  cout << setprecision(18)<<ans << endl;
}
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n , k;
  double ans = 0;
  cin>>n>>k;
  double dice;
  double coin;

  for(int i = 1; i <= n; i++ ){
    int j = 1;
    int temp;
    temp = i;
    while(k > temp){
      temp *= 2;
      j *= 2;
    }
    double dice = n;
    double coin = j;
    ans += (1.00000000000/dice)*(1.00000000000/coin);
    //cout<<"i ="<<i<<", dice = "<<dice<<", coin = "<<coin<<", ans = "<<ans<<endl;
  }
  cout << setprecision(18)<<ans << endl;
}


Compiler output:
a.cc:27:5: error: redefinition of 'int main()'
   27 | int main(){
      |     ^~~~
a.cc:3:5: note: 'int main()' previously defined here
    3 | int main(){
      |     ^~~~
Language: C++

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

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

  double score, ans;
  score = 0;
  for (int score = 1; score < N+1; score++){
      while (score <= K){
          score *= 2;
          X /= 2;
      }
      ans += X 
  }

  cout << std::setprecision(10) << ans / N << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:11: error: 'X' was not declared in this scope
   14 |           X /= 2;
      |           ^
a.cc:16:14: error: 'X' was not declared in this scope
   16 |       ans += X
      |              ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main(void){
  int n,k;
  cin>>n>>k;
  double r=0;
  for(int i=1;i<=a;i++){
    double t=1.0/n;
	int now=i;
    while(now<k){
      now*=2;
      t/=2;
    }
    r+=t;
  }
  cout<<r;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:18: error: 'a' was not declared in this scope
    7 |   for(int i=1;i<=a;i++){
      |                  ^
Language: C++

#include <stdio.h>
int main(void){
	long long n, k, bunbos[100000] = {0}, max = 0, bunsi = 0, p = 0;
	scanf("%d %d", &n, &k);
	for(int i = 1; i <= n; i++){
		int dice = i, two = 1;
		while(dice < k){
			dice *= 2;
			two *= 2;
		}
		bunbos[i - 1] = two;
		if(two > max){
			max = two;
		}
		p++;
	}
	for(int i = 0; i < p; i++){
		bunsi += max / bunbos;
	}
	bunsi += (n - k + 1) * max;
	printf("%.12f", (double)(bunsi / (max * n)))
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:30: error: invalid operands of types 'long long int' and 'long long int [100000]' to binary 'operator/'
   18 |                 bunsi += max / bunbos;
      |                          ~~~ ^ ~~~~~~
      |                          |     |
      |                          |     long long int [100000]
      |                          long long int
a.cc:21:53: error: expected ';' before 'return'
   21 |         printf("%.12f", (double)(bunsi / (max * n)))
      |                                                     ^
      |                                                     ;
   22 |         return 0;
      |         ~~~~~~
Language: C++

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

int main(){
    int A,B;
    cin >> A >> B;
    double ans = 0;
    double Y = 0;
    double Z = 0;
    for(int i=1;i<=A;i++){
        Y = 1.0/a;
        Z = i;
        while(Z<b){
            Z = Z * 2;
            Y = Y/2;
        }
        
        ans = ans + Y;
    }

    cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:17: error: 'a' was not declared in this scope
   13 |         Y = 1.0/a;
      |                 ^
a.cc:15:17: error: 'b' was not declared in this scope
   15 |         while(Z<b){
      |                 ^