criyle/codenet-compile-errors huggingface dataset:
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<ll> bai(17, 1);
  REP(i, 17){
    bai[i] = bai[i-1]*2;
  }
  
  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;
    }
  }
  unsigned double ans=0;
  FOR(i, 1, N+1){
    unsigned double me = 1;
    REP(j, p[i]){
      me *=2;
    }
    ans += 1 / me;
  }
  ans /= N;
  printf("%.12lf\n", ans);
  
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:37:3: error: 'unsigned' specified with 'double'
   37 |   unsigned double ans=0;
      |   ^~~~~~~~
a.cc:39:5: error: 'unsigned' specified with 'double'
   39 |     unsigned double me = 1;
      |     ^~~~~~~~
Language: C++


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

int main() {
	double a, b;
	long double sum = 0;
	int pown;

	cin >> a >> b;

	
	for (int i = 0; i < a; i++)
	{
		pown = ceil(log2(b / (i + 1)));
		if (pown < 0)
			pown = 0;
		sum += (1 / a) * powf(0.5, pown);
	}
	cout << setprecision(12) << sum << endl;

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:29: error: 'log2' was not declared in this scope
   17 |                 pown = ceil(log2(b / (i + 1)));
      |                             ^~~~
a.cc:17:24: error: 'ceil' was not declared in this scope
   17 |                 pown = ceil(log2(b / (i + 1)));
      |                        ^~~~
a.cc:20:34: error: 'powf' was not declared in this scope; did you mean 'pown'?
   20 |                 sum += (1 / a) * powf(0.5, pown);
      |                                  ^~~~
      |                                  pown
Language: C++

#include<stdio.h>
#include<iostream>
#include<algorithm>
#define LIMIT 100
using namespace std;
int main()
{
	int n, k;
	int i;
	int tmp;
	int total = 0;

	cin >> n >> k;

	int j = 0;
	int two;
	int coin[LIMIT];
	double atmp = 0.0;
	for (i = 2, j = 0; j < n;i++,j++) {
		tmp = ceil(log2(k) / log2(i));
		total += tmp;
		if (i == 2) {
			two = tmp;
		}
		if (i > k) {
			atmp += pow(2,two);
		}
		else {
			atmp += (double)pow(2, two - tmp);
		}
		//cout << "log2 " << i << "  = " << tmp << " / "<<atmp<<endl;
	}

	double a = atmp;
	double b = pow(2, two);
	double c = n;

	printf("%.13lf\n", a / b / c);

	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:20:28: error: 'log2' was not declared in this scope
   20 |                 tmp = ceil(log2(k) / log2(i));
      |                            ^~~~
a.cc:20:23: error: 'ceil' was not declared in this scope
   20 |                 tmp = ceil(log2(k) / log2(i));
      |                       ^~~~
a.cc:26:33: error: 'pow' was not declared in this scope
   26 |                         atmp += pow(2,two);
      |                                 ^~~
a.cc:29:41: error: 'pow' was not declared in this scope
   29 |                         atmp += (double)pow(2, two - tmp);
      |                                         ^~~
a.cc:35:20: error: 'pow' was not declared in this scope
   35 |         double b = pow(2, two);
      |                    ^~~
Language: C++


    int N, K;
    cin>>N>>K;
    double prob_above = 0;
    double prob_below = 0;
    int max = N;
    if(N>=K){
        prob_above = double((N-K+1))/N;
        max = K-1;
    }

    for(int i=1; i<=max; i++){
        prob_below+=(1.0f/N)*pow(1.0f/2.0f, ceil(log2(double(K)/i)));
    }
    cout<<std::setprecision(100)<<prob_above+prob_below<<endl;

    return 0;

Compiler output:
a.cc:3:5: error: 'cin' does not name a type
    3 |     cin>>N>>K;
      |     ^~~
a.cc:7:5: error: expected unqualified-id before 'if'
    7 |     if(N>=K){
      |     ^~
a.cc:12:5: error: expected unqualified-id before 'for'
   12 |     for(int i=1; i<=max; i++){
      |     ^~~
a.cc:12:18: error: 'i' does not name a type
   12 |     for(int i=1; i<=max; i++){
      |                  ^
a.cc:12:26: error: 'i' does not name a type
   12 |     for(int i=1; i<=max; i++){
      |                          ^
a.cc:15:5: error: 'cout' does not name a type
   15 |     cout<<std::setprecision(100)<<prob_above+prob_below<<endl;
      |     ^~~~
a.cc:17:5: error: expected unqualified-id before 'return'
   17 |     return 0;
      |     ^~~~~~
Language: C++

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

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

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

#define INF 999999999;
#define MOD 1000000007;

//#define EVEL 1

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


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

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

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

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


Compiler output:
a.cc: In function 'int main()':
a.cc:60:41: error: cannot convert 'long double*' to 'double*'
   60 |         long double r = modf(kk/log(2), &z);
      |                                         ^~
      |                                         |
      |                                         long double*
In file included from /usr/include/math.h:275,
                 from /usr/include/c++/14/cmath:47,
                 from a.cc:8:
/usr/include/x86_64-linux-gnu/bits/mathcalls.h:128:1: note:   initializing argument 2 of 'double modf(double, double*)'
  128 | __MATHCALL (modf,, (_Mdouble_ __x, _Mdouble_ *__iptr)) __nonnull ((2));
      | ^
a.cc: At global scope:
a.cc:78:2: error: expected unqualified-id before '/' token
   78 | */
      |  ^
Language: C++

#include <algorithm>
#include <bitset>
#include <cstdio>
#include <cstdlib>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#define REP(i, b, n) for (Int i = b; i < Int(n); i++)
#define rep(i, n) REP(i, 0, n)
using namespace std;
using Int = long long;
Int inf = 1000000000000000001LL;
using vi = vector<Int>;
using vvi = vector<vi>;

Int GCD(Int a, Int b){
    if(b==0) return a;
    if(a < b) return GCD(b, a);
    unsigned r;
    while ((r=a%b)) {
        a = b;
        b = r;
    }
    return b;
}
int binary_search_index(Int Y, vi &q){
    int left = 0, right = q.size() - 1;
    while (right >= left) {
        int mid = left + (right - left) / 2;
        if (q[mid] == Y) return mid;
        else if (q[mid] > Y) right = mid - 1;
        else if (q[mid] < Y) left = mid + 1;
    }
    return -1;
}

int count(Int point, Int goal){
    int count=0;
    while(point< goal){
        point *= 2;
        count++;
    }
    return count;
}

int main() {
    double N,K;
    cin >> N >> K;
    vector<double> a;
    double ans =0;

    REP(i,1,N+1){
        double base = (1.0/N);
        double plus;
        int pow_count = count(i,K);
        if(pow_count == 0){
            a.push_back(base);
        }else{
            plus = 1/(pow(2,pow_count));
            a.push_back(base*plus);
        }
    }

    rep(i,a.size()){
        ans += a[i];
    }

    cout << ans << endl;

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:68:23: error: 'pow' was not declared in this scope
   68 |             plus = 1/(pow(2,pow_count));
      |                       ^~~
Language: C++

#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cstring>
#include <complex>
#include <stack>
#include <queue>
#include <unordered_map>
#include <map>
using namespace std;
using ll = long long;
int main() {
    int t, i, n, k;
    int tmp1, tmp2;
    int ans = 0;
    int tmp = 0;
  	cin >> n >> k;
    for (i=1;i<n+1;i++) {
        tmp = i
        for (t=0;tmp<k;t++) {
            tmp *= 2
        ans += (1/n) * (0.5) ** tmp
        }
    }
    cout << ans << endl; 
}

Compiler output:
a.cc: In function 'int main()':
a.cc:20:16: error: expected ';' before 'for'
   20 |         tmp = i
      |                ^
      |                ;
   21 |         for (t=0;tmp<k;t++) {
      |         ~~~     
a.cc:21:27: error: expected ';' before ')' token
   21 |         for (t=0;tmp<k;t++) {
      |                           ^
      |                           ;
Language: C++

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

int main()
{
	int N, K;
	cin >> N >> K;
	double percent=0;
	int score;
	double last = 0.0;
	double count = 0.0;
	int s;
	for (score = 1; score <= N; score++) {
		count = 0.0;
		percent = 1.0 / N;
		s = score;
		while (s < K) {
			s = s * 2;
			count += 1.0;
		}
		percent = percent * pow(0.5, count);
	
		last += percent;
	}

	cout << std::setprecision(12) << last;

	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:26:37: error: 'pow' was not declared in this scope
   26 |                 percent = percent * pow(0.5, count);
      |                                     ^~~
Language: C++

#include <algorithm>
#include <iomanip>
#include <iostream>
#include <string>
#include <typeinfo>
#include <vector>

using namespace std;
using ll = long long int;

// to format a document: ctrl + K -> ctrl + D

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

    double win  = max(0.0, 1.0 * (N - K + 1) / N);
    double base = 1.0 - win;

    double ans = 0.0;
    for (int i = 1; i <= N && i <= K - 1; i++) {
        int ii  = i * 2;
        int cnt = 1;
        while (ii < K) {
            ii *= 2;
            cnt++;
        }
        ans += pow(2, -cnt);
    }
    ans /= min(N, K - 1);

    ans *= base;
    ans += win;

    cout << setprecision(10) << ans << endl;

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:28:16: error: 'pow' was not declared in this scope
   28 |         ans += pow(2, -cnt);
      |                ^~~
Language: C++


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

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

int main(void) {
	int n, k;
	cin >> n >> k;
	double ans=0.0f;
	rep(i, n) {
		double tmp = log2((double)(k) / (double)(i + 1)) ;
		if(tmp >= (double)((int)tmp))
			ans += 1.0f/  (double)( 1 << (int)( tmp+1) );
		else
			ans += 1.0f / (double)(1 << (int)(tmp));
	}
	cout << ans / (double)(n);
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:30: error: 'log2' was not declared in this scope
   13 |                 double tmp = log2((double)(k) / (double)(i + 1)) ;
      |                              ^~~~
Language: C++

#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <random>
#include <string.h>

using namespace std;

int main() {
	int N, K;
	float res = 0.0;
	scanf_s("%d %d", &N, &K);
		for (int i = 1; i <= N; i++) {
			int cur = i;
			float count = 0;
			while (cur < K) {
				cur *= 2;
				count += 1;
			}
			res += pow(0.5, count)/N;
		}
		cout << res << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:28:9: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'?
   28 |         scanf_s("%d %d", &N, &K);
      |         ^~~~~~~
      |         scanf
Language: C++

#include<utility>
#include<algorithm>

using namespace std;

typedef pair<int, int> P;
typedef long long int ll;

long double N, K;

int main() {
	cin >> N >> K;
	long double ans = 0.0;
	long double coin = N;
	if (N >= K) {//コインなし
		ans += (N - K + 1.0) / N;
		coin = K - 1.0;
	}
	for (long double i = 1; i <= coin; i++) {
		long double num = i;
		long double c_num = 1.0 / N;
		while (num < K) {
			num *= 2.0;
			c_num *= 0.5;
		}
		//cout << "c_num = " << c_num << endl;
		ans += c_num;
	}
	cout << setprecision(16) << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:9: error: 'cin' was not declared in this scope
   12 |         cin >> N >> K;
      |         ^~~
a.cc:3:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    2 | #include<algorithm>
  +++ |+#include <iostream>
    3 | 
a.cc:29:9: error: 'cout' was not declared in this scope
   29 |         cout << setprecision(16) << ans << endl;
      |         ^~~~
a.cc:29:9: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:29:17: error: 'setprecision' was not declared in this scope
   29 |         cout << setprecision(16) << ans << endl;
      |                 ^~~~~~~~~~~~
a.cc:3:1: note: 'std::setprecision' is defined in header '<iomanip>'; this is probably fixable by adding '#include <iomanip>'
    2 | #include<algorithm>
  +++ |+#include <iomanip>
    3 | 
a.cc:29:44: error: 'endl' was not declared in this scope
   29 |         cout << setprecision(16) << ans << endl;
      |                                            ^~~~
a.cc:3:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
    2 | #include<algorithm>
  +++ |+#include <ostream>
    3 |
Language: C++

#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <string>
#include <stdio.h>
using namespace std;

int main()
{
	int N, K;
	cin >> N >> K;
	double percent=0;
	int score;
	double last = 0.0;
	double count = 0.0;
	int s;
	for (score = 1; score <= N; score++) {
		count = 0.0;
		percent = 1.0 / N;
		s = score;
		while (s < K) {
			s = s * 2;
			count += 1.0;
		}
		percent = percent * pow(0.5, count);
	
		last += percent;
	}

	printf("%.12f", last);

	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:26:37: error: 'pow' was not declared in this scope
   26 |                 percent = percent * pow(0.5, count);
      |                                     ^~~
Language: C++

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

int main() {
	double a, b;

	cin >> a >> b;


	double n;
	long double sum = 0;
	for (int i = 0; i < a; i++)
	{
		int pown = ceil(log2(b / (i + 1)));
		if (pown < 0)
			pown = 0;
		sum += (1 / a) * pow(0.5, pown);
	}
	cout << setprecision(12) << sum << endl;

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:33: error: 'log2' was not declared in this scope
   16 |                 int pown = ceil(log2(b / (i + 1)));
      |                                 ^~~~
a.cc:16:28: error: 'ceil' was not declared in this scope
   16 |                 int pown = ceil(log2(b / (i + 1)));
      |                            ^~~~
a.cc:19:34: error: 'pow' was not declared in this scope; did you mean 'pown'?
   19 |                 sum += (1 / a) * pow(0.5, pown);
      |                                  ^~~
      |                                  pown
Language: C++

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

int main()
{
	int N, K;
	cin >> N >> K;
	double percent=0;
	int score;
	double last = 0.0;
	double count = 0.0;
	int s;
	for (score = 1; score <= N; score++) {
		count = 0.0;
		percent = 1.0 / N;
		s = score;
		while (s < K) {
			s = s * 2;
			count += 1.0;
		}
		percent = percent * pow(0.5, count);
	
		last += percent;
	}

	printf("%.12f", last);

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:25:37: error: 'pow' was not declared in this scope
   25 |                 percent = percent * pow(0.5, count);
      |                                     ^~~
Language: C++

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

using ll = long long;
const ll amari = 1e9+7;
const char BC = 'A' - 'a';
#define ben(a) a.begin(),a.end()
#define pb(a,b) a.push_back(b)

int main(){
	double n,k;
	cin >> n >> k;
	double win = n - k + 1.0;
	double ans = 0.0;
	if(win > 0){
		ans += win / n;
	}
	for(double i = 1.0; i <= n; i += 1.0){
		if(i == k){
			break;
		}
		double m = 0.0;
		int p = (int)k / (int)i;
		while(p > 0){
			p /= 2;
			m += 1.0;
		}
		double plus = (1.0 / n) * pow(0.5,m);
		ans += plus;
	}
	std::cout<<std::fixed<<std::setprecision(10)
	cout << ans << endl;
	return 0; 
}


Compiler output:
a.cc: In function 'int main()':
a.cc:31:53: error: expected ';' before 'cout'
   31 |         std::cout<<std::fixed<<std::setprecision(10)
      |                                                     ^
      |                                                     ;
   32 |         cout << ans << endl;
      |         ~~~~
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 ALL(x) (x).begin(),(x).end()
 
int GCD(int a,int b){ return b ? GCD(b,a%b) : a ;}
int LCM(int a,int b){ return a*b / GCD(a,b) ;}
 
typedef long long ll;
typedef unsigned long long ull;
 
const int INF = 1e9;

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

Compiler output:
a.cc: In function 'int main()':
a.cc:24:26: error: 'tmp2' was not declared in this scope; did you mean 'tmp'?
   24 |             double tmp = tmp2 = 0;
      |                          ^~~~
      |                          tmp
Language: C++

#include<iostream>
#include<string>
#include<bits/stdc++.h>
#include<algorithm>
#include<cmath>
#include<vector>
using namespace std;

int main(){
  int N,K;
  long long double ans=0;
  cin>>N>>K;
  
  int p,l=1;
  for(int i=1; i<21; ++i){
    l*=2;
    if(K<=l){
      p=i;
      break;
    }
  }
  
  int e=1;
  for(int i=0; i<p; ++i) e*=2;
  
  for(int i=1; i<=N; ++i){
    int s=i;
    for(int j=1; j<21; ++j){
      if(K<=s){
        ans+=e/(s/i);
        break;
      }
      s*=2;
    }
  }
  
  ans*=10000000000;
  ans/=(N*e);
  
  cout<<ans/10000000000<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:8: error: 'long long' specified with 'double'
   11 |   long long double ans=0;
      |        ^~~~
Language: C++

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

using namespace std;


int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	int n, k;
	double ans = 0;
	
	cin >> n >> k;
	
	for (int i = 1; i <= n; ++i) {
		if (i <= k) {
			int q = ceil(log2(k * 1.0 / i));
			ans += pow(0.5, q);
		}
		else {
			ans += 1.0;
		}
	}

	cout << setprecision(10) << ans / n << endl;
	
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:23:38: error: 'log2' was not declared in this scope
   23 |                         int q = ceil(log2(k * 1.0 / i));
      |                                      ^~~~
a.cc:23:33: error: 'ceil' was not declared in this scope
   23 |                         int q = ceil(log2(k * 1.0 / i));
      |                                 ^~~~
a.cc:24:32: error: 'pow' was not declared in this scope
   24 |                         ans += pow(0.5, q);
      |                                ^~~
Language: C++

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

int main() {
	double a, b;

	cin >> a >> b;


	double n;
	long double sum = 0;
	for (int i = 0; i < a; i++)
	{
		int pown = ceil(log2(b / (i + 1)));
		if (pown < 0)
			pown = 0;
		sum += (1 / a) * pow(0.5, pown);
	}
	cout << setprecision(12) << sum << endl;

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:33: error: 'log2' was not declared in this scope
   16 |                 int pown = ceil(log2(b / (i + 1)));
      |                                 ^~~~
a.cc:16:28: error: 'ceil' was not declared in this scope
   16 |                 int pown = ceil(log2(b / (i + 1)));
      |                            ^~~~
a.cc:19:34: error: 'pow' was not declared in this scope; did you mean 'pown'?
   19 |                 sum += (1 / a) * pow(0.5, pown);
      |                                  ^~~
      |                                  pown
Language: C++

#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
using namespace std;
const int maxn = 100100;


int main()
{
	int n, k;
	cin >> n >> k;
	long double p=0.0;
	//double tmp = k/n;
	for (int i = 1; i <= n; i++)
	{
		if (i>=k)
		{
			p = p + 1.0;
			continue;
		}
		double tmp = ceil(log(((double)k/(double)i))/log(2));
		cout <<  tmp<<' '<< pow(0.5, tmp) << endl;

		
		p = p + pow(0.5, tmp);

		
		
	}
	p = p / n;
	cout << p << endl;
	//system("pause");
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:22:35: error: 'log' was not declared in this scope; did you mean 'long'?
   22 |                 double tmp = ceil(log(((double)k/(double)i))/log(2));
      |                                   ^~~
      |                                   long
a.cc:22:30: error: 'ceil' was not declared in this scope
   22 |                 double tmp = ceil(log(((double)k/(double)i))/log(2));
      |                              ^~~~
a.cc:23:37: error: 'pow' was not declared in this scope
   23 |                 cout <<  tmp<<' '<< pow(0.5, tmp) << endl;
      |                                     ^~~
Language: C++

//#include <bits/stdc++.h>
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstdlib>
#include <string>
#include <vector>
#include <map>
#include <queue>

using namespace std;

typedef long long ll;
typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<n;++i)
#define mod (ll)(1e9+7)
#define FIX(a) ((a)%mod+mod)%mod
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define fi first
#define se second
#define pb push_back
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};
ll pw(ll x,int y){
    REP(i,y){
        x*=2;
    }
    return x;
}
vint time(20,0);
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n,k;
    int now;
    cin >> n >> k;
    if(n>=k){
        time[0]=n-k+1;
        now=k;
    }else{
        now = n+1;
    }
    for(int i=1;i<18;++i){
        if(pw(now,i)<k){
            continue;
        }
        ll ok = now;
        ll ng = -1;
        while(abs(ok-ng)>1){
            ll mid = (ok+ng)/2;
            if(pw((ll)mid,i)>=k){
                ok = mid;
            }else{
                ng = mid;
            }
        }
        time[i]=now-ok;
        now=ok;
    }
    ll bunsi = 0;
    ll bunbo = 0;
    bunbo = pw(1,17)*(ll)n;
    REP(i,18){
        bunsi+=(ll)time[i]*pw(1,17-i);
    }
    double ans = (double)bunsi/(double)bunbo;
    printf("%.10f\n",ans);
    return 0;
}

Compiler output:
a.cc:37:10: error: 'vint time' redeclared as different kind of entity
   37 | vint time(20,0);
      |          ^
In file included from /usr/include/pthread.h:23,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/gthr-default.h:35,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/gthr.h:157,
                 from /usr/include/c++/14/ext/atomicity.h:35,
                 from /usr/include/c++/14/bits/ios_base.h:39,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:2:
/usr/include/time.h:76:15: note: previous declaration 'time_t time(time_t*)'
   76 | extern time_t time (time_t *__timer) __THROW;
      |               ^~~~
a.cc: In function 'int main()':
a.cc:45:15: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   45 |         time[0]=n-k+1;
      |               ^
a.cc:45:16: error: assignment of read-only location '* time'
   45 |         time[0]=n-k+1;
      |         ~~~~~~~^~~~~~
a.cc:64:15: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   64 |         time[i]=now-ok;
      |               ^
a.cc:64:16: error: assignment of read-only location '*(time + ((sizetype)i))'
   64 |         time[i]=now-ok;
      |         ~~~~~~~^~~~~~~
a.cc:71:26: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   71 |         bunsi+=(ll)time[i]*pw(1,17-i);
      |                          ^
Language: C++

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

int xp(int x, int y){
  if (y==0){
    return 0;
  }
  for (int i=0; i<y-1; i++){
    x *= x;
  }
  return x;
}

int main() {
  int n,k;
  cin >> n >> k;
  double answer;
  double bunbo;
  double bunshi;
  int twocount;
  int is=1;
  int t=0;
  int now=1;
  while (true){
    if (is >= k){
      twocount = t;
      break;
    }
    is *= 2;
    t++;
  }
  bunbo = n * ep(2,twocount);
  for (int i=1; i<=n; i++){
  	if (i== now * 2) now *= 2;
    bunshi += now;
  }
  cout << bunshi / bunbo << endl;
}
  
  

Compiler output:
a.cc: In function 'int main()':
a.cc:32:15: error: 'ep' was not declared in this scope; did you mean 'xp'?
   32 |   bunbo = n * ep(2,twocount);
      |               ^~
      |               xp
Language: C++

#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <unordered_map>
#include <unordered_set>
#include <stdio.h>

using namespace std;

typedef unsigned long long ull;
typedef unsigned int uint;
typedef unsigned char uchar;
#define umap unordered_map
const static ull INVALID_DIGIT = ~(ull)0;

umap<ull, int> resultCache;

int main()
{
    int N, K;

    cin >> N >> K;

    double firstWinProb = std::max(0.0, 1.0 * (N - K + 1) / N);

    double firstLoseProb = 1 - firstWinProb;
    double firstLoseFinallyWinProb = 0;

    int firstLosePatternNum = std::min(N, K - 1);
    if (firstLosePatternNum > 0)
    {
        for (int k = 1; k <= firstLosePatternNum; k++)
        {
            double shouldCoinWinCount = std::ceil(std::log2(1.0 * K / k));
            firstLoseFinallyWinProb += std::pow(0.5, shouldCoinWinCount);
        }
        firstLoseFinallyWinProb *= firstLoseProb / firstLosePatternNum;
    }

    printf("%.15lf\n", (firstWinProb + firstLoseFinallyWinProb));

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:35:46: error: 'ceil' is not a member of 'std'
   35 |             double shouldCoinWinCount = std::ceil(std::log2(1.0 * K / k));
      |                                              ^~~~
a.cc:35:56: error: 'log2' is not a member of 'std'
   35 |             double shouldCoinWinCount = std::ceil(std::log2(1.0 * K / k));
      |                                                        ^~~~
a.cc:36:45: error: 'pow' is not a member of 'std'
   36 |             firstLoseFinallyWinProb += std::pow(0.5, shouldCoinWinCount);
      |                                             ^~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N, K;
  cin >> N >> K;
  
  vector<int>A(N);
  vector<int>B(N)
  for (int i = 0; i < N; i++){
    A.at(i) = i+1;
    
    while(A.at(i) < K){
      A.at(i) *= 2;
      B.at(i)++;
    }
  }
  vector<double>C(N);
  for(int i = 0; i < N; i++) {
    C.at(i) = pow(0.5,B.at(i));
  }
  double ans = 0;
  for (int i = 0; i < N; i++){
    ans += C.at(i);
  }
  cout << ans/N << endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:10:3: error: expected ',' or ';' before 'for'
   10 |   for (int i = 0; i < N; i++){
      |   ^~~
a.cc:10:19: error: 'i' was not declared in this scope
   10 |   for (int i = 0; i < N; i++){
      |                   ^
Language: C++

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

int xp(int x, int y){
  if (y==0){
    return 0;
  }
  for (int i=0; i<y-1; i++){
    x *= x;
  }
  return x;
}

int main() {
  int n,k;
  cin >> n >> k;
  double answer;
  double bunbo;
  double bunshi;
  int twocount;
  int is=1;
  int t=0;
  int now=1;
  while (true){
    if (is >= k){
      twocount = t;
      break;
    }
    is *= 2;
    t++;
  }
  bunbo = n * ex(2,twocount);
  for (int i=1; i<=n; i++){
  	if (i== now * 2) now *= 2;
    bunshi += now;
  }
  cout << bunshi / bunbo << endl;
}
  
  

Compiler output:
a.cc: In function 'int main()':
a.cc:32:15: error: 'ex' was not declared in this scope; did you mean 'exp'?
   32 |   bunbo = n * ex(2,twocount);
      |               ^~
      |               exp
Language: C++

#include<cmath>
using namespace std;
int main()
{
  float i,n,k,sum=0,temp,p=0,res=0;
  int p;
  cin>>n>>k;
  for(i=1;i<=n;i++)
  {
    while(res<k)
    {
      res = i*2;
      p++;
    }
    sum += (1/n)*pow((1/2),p);
  }
  cout<<sum;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:7: error: conflicting declaration 'int p'
    6 |   int p;
      |       ^
a.cc:5:26: note: previous declaration as 'float p'
    5 |   float i,n,k,sum=0,temp,p=0,res=0;
      |                          ^
a.cc:7:3: error: 'cin' was not declared in this scope
    7 |   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<cmath>
  +++ |+#include <iostream>
    2 | using namespace std;
a.cc:17:3: error: 'cout' was not declared in this scope
   17 |   cout<<sum;
      |   ^~~~
a.cc:17:3: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
Language: C++

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

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

	double result = 0.0;

	const double firstRatio = 1.0 / (double)N;
	for (int n = 1; n <= N; ++n) {
		int count = 0;
		int checkPointOK = n;
		while (checkPointOK < K) {
			checkPointOK *= 2;
			++count;
		}
		result += firstRatio * pow(0.5, count);
	}
	
	cout << fixed;
	cout << setprecision(12) << result << endl;

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:20:40: error: 'pow' was not declared in this scope
   20 |                 result += firstRatio * pow(0.5, count);
      |                                        ^~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define M int (1e9+7)
int main() {
	int n, k;
	cin >> n >> k;
	long double ans = 0;
	int id = 1;
	long double res = long double (1) / n;
	for (int i = n; i >= 1; i--){
		int x = id;
		for (;i * id < k; id *= 2);
		for (; x < id; x *= 2)
			res *= long double(1) / 2;
		ans += res;
	}
	cout.precision(9);
	cout <<ans <<endl;
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:9:27: error: expected primary-expression before 'long'
    9 |         long double res = long double (1) / n;
      |                           ^~~~
a.cc:14:32: error: expected primary-expression before 'long'
   14 |                         res *= long double(1) / 2;
      |                                ^~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N, K;
  cin >> N >> K;
  
  vector<int>A(N);
  vector<int>B(N)
  for (int i == 0; i < N;){
    A.at(i) = i+1;
    
    while(A.at(i) < K){
      A.at(i) *= 2;
      B.at(i)++;
    }
  }
  vector<double>C(N);
  for(int i = 0; i < N; i++) {
    C.at(i) = pow(0.5,B.at(i));
  }
  double ans = 0;
  for (int i == 0; i < N;){
    ans += C.at(i);
  }
  cout << ans/N << endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:3: error: expected ',' or ';' before 'for'
   10 |   for (int i == 0; i < N;){
      |   ^~~
a.cc:10:20: error: 'i' was not declared in this scope
   10 |   for (int i == 0; i < N;){
      |                    ^
a.cc:10:26: error: expected primary-expression before ')' token
   10 |   for (int i == 0; i < N;){
      |                          ^
a.cc:23:13: error: expected ';' before '==' token
   23 |   for (int i == 0; i < N;){
      |             ^~~
      |             ;
a.cc:23:14: error: expected primary-expression before '==' token
   23 |   for (int i == 0; i < N;){
      |              ^~
a.cc:23:25: error: expected ')' before ';' token
   23 |   for (int i == 0; i < N;){
      |       ~                 ^
      |                         )
a.cc:23:26: error: expected primary-expression before ')' token
   23 |   for (int i == 0; i < N;){
      |                          ^
Language: C++

#include<iostream>
#include<vector>
#include<string>
#include<stdlib.h>
#include<algorithm>
#include<math.h>
using namespace std;


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

	long double sum = 0;

	for (long double i = 1; i <= N; i++) {
		long double count = 0;

		while (i * pow(2,count) <= K-1)
			count++;

		sum += (1 / N) * (1 / pow(2, count));

	}

	printf_s("%.10f", sum);
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:27:9: error: 'printf_s' was not declared in this scope; did you mean 'printf'?
   27 |         printf_s("%.10f", sum);
      |         ^~~~~~~~
      |         printf
Language: C++

int main() {
	int n, k;
	cin >> n >> k;
	double ans = 0;
	bool f = true;
	long count = 0;
	for (int i = 1; i <= n; i++)
	{
		f = true;
		count = 0;
		while (f)
		{
			//cout << i * pow(2,count) << endl;;
			if ((i * pow(2, count)) >= k)
			{
				f = false;
				//cout << count << endl;
			}
			count++;
		}
		ans = ans + (1 / pow(2, count));
	}
	ans /= n;
	cout << ans*2;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:3:9: error: 'cin' was not declared in this scope
    3 |         cin >> n >> k;
      |         ^~~
a.cc:14:34: error: 'pow' was not declared in this scope
   14 |                         if ((i * pow(2, count)) >= k)
      |                                  ^~~
a.cc:21:34: error: 'pow' was not declared in this scope
   21 |                 ans = ans + (1 / pow(2, count));
      |                                  ^~~
a.cc:24:9: error: 'cout' was not declared in this scope; did you mean 'count'?
   24 |         cout << ans*2;
      |         ^~~~
      |         count
Language: Java

import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int K = sc.nextInt();

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

            prob+= (double) 1/N * Math.pow((double) 0.5 , log(K/i,2 )) ;

        }

        System.out.println(prob);
    }


    static int log(int x, int base)
    {
        return (int) Math.ceil (Math.log(x) / Math.log(base));
    }

Compiler output:
Main.java:24: error: reached end of file while parsing
    }
     ^
1 error
Language: C++

#include<iostream>
using namespace std;
int main(){
int n,k;
  cin>>n>>k;
  int count[n];
  int c=k;
  for(int i=0;i<n;i++){
  	count[i]=0;
    c=k;
    while(true){
    if(c/i>=2){
      c/=2;
      count[i]++;
    }
  }
    int ans=0;
    int l=1;
    for(int i=0;i<n;i++){
      l=1;
    for(int j=0;j<count[i];i++){
    l/=2;
    }
      ans+=l;
    }
    cout<<ans<<endl;
}


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

#define _USE_MATH_DEFINES
#include<bits/stdc++.h>
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,a,b) for(int i=0;i<b;i++)
#define REP(i,a,b) for(int i=0;i<=b;i++)
#define rev(i,n) for(int i=n-1;i>=0;i--)
#define vi vector<int>
#define vvi vector<vi>
#define pb push_back
#define pi pair<int,int>
#define vp vector<pair<int,int>>
#define mp make_pair
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define MEMSET(a) memset(a,0,sizeof(a))
#define inf (1ll<<60)
#define Yes(f) cout <<(f?"Yes":"No")<<endl//fが真の場合Yesを出力、偽の場合Noを出力
#define yes(f) cout <<(f?"yes":"no")<<endl
#define YES(f) cout <<(f?"YES":"NO")<<endl
#define SORT(v) sort(all(v))
#define RSORT(v) sort(all(v),greater<int>())

using namespace std;

const int mod=1e9+7;

signed main(){
    //n:いくつ面があるか、ｋ：目標点数
    int n,k:
    cin >> n >> k;

    float ans=n;
    float kakuritu=1;
    int j;
    for(int i=1;i<k;i++)
    {
        j=i;
        while(j<=k)
        {
            j*=2;
            kakuritu*=0.5;
        }
        ans-=1-kakuritu;
    }
    ans/=n;
    cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:31:12: error: found ':' in nested-name-specifier, expected '::'
   31 |     int n,k:
      |            ^
      |            ::
a.cc:31:11: error: 'k' has not been declared
   31 |     int n,k:
      |           ^
a.cc:32:9: error: qualified-id in declaration before '>>' token
   32 |     cin >> n >> k;
      |         ^~
a.cc:37:19: error: 'k' was not declared in this scope
   37 |     for(int i=1;i<k;i++)
      |                   ^
Language: Java

import java.math.*;
import java.util.Scanner;

public class DiceAndCoin {

    static final int modnum = 1000000007;

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int K = sc.nextInt();

        double ans = 0;

        // int needone = (int) Math.ceil(Math.log(K) / Math.log(2));
        // double perone = Math.pow(0.5, needone);
        // System.out.println(needone + " " + perone);
        // ans += perone;

        for (int i = 1; i <= N; i++) {
            if (i >= K) {
                ans += 1;
                continue;
            }
            int need = (int) Math.ceil(Math.log((double) K / i) / Math.log(2));
            double per = Math.pow(0.5, need);
            // System.out.println(need + " " + per);
            ans += per;
        }
        ans /= N;
        // System.out.println();
        System.out.println(ans);
    }
}

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

int main(){
	int N;
  	int K;
  	int i;
  	double	c;
  for(i=0;i<N;i++){
	if(K<i<N){
      c=c+(1/N);
    } else{
      c=c+(1/N)*((1/2)^(K-i+1);
                 }
                 }
                 printf("%f\n",c);
                 return 0;
                 }
                 


Compiler output:
main.c: In function 'main':
main.c:10:31: error: expected ')' before ';' token
   10 |       c=c+(1/N)*((1/2)^(K-i+1);
      |                 ~             ^
      |                               )
main.c:10:32: error: expected ';' before '}' token
   10 |       c=c+(1/N)*((1/2)^(K-i+1);
      |                                ^
      |                                ;
   11 |                  }
      |                  ~              
main.c:13:18: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
   13 |                  printf("%f\n",c);
      |                  ^~~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'printf'
  +++ |+#include <stdio.h>
    1 | int main(){
main.c:13:18: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
   13 |                  printf("%f\n",c);
      |                  ^~~~~~
main.c:13:18: note: include '<stdio.h>' or provide a declaration of 'printf'
Language: C++

#include <iostream>

using namespace std;

int calcTimes(int t, int n, int k) {
	if (n >= k) return 0;
	if (n * 2 >= k) return t + 1;
	return calcTimes(t + 1, n * 2, k);
}

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

	int coinTimes;
	double rate = 0;
	for (int i = 1; i <= n; i++) {
		coinTimes = calcTimes(0, i, k);

		rate += std::pow(0.5, coinTimes);
	}
	rate /= n;

	cout << rate << endl;

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:20:30: error: 'pow' is not a member of 'std'
   20 |                 rate += std::pow(0.5, coinTimes);
      |                              ^~~
Language: C++

#include<iostream>
using namespace std;
int main(){
int n.k;
  cin>>n>>k;
  int count[n];
  int c=k;
  for(int i=0;i<n;i++){
  	count[i]=0;
    c=k;
    while(true){
    if(c/i>=2){
      c/=2;
      count[i]++;
    }
  }
    int ans=0;
    int l=1;
    for(int i=0;i<n;i++){
      l=1;
    for(int j=0;j<count[i];i++){
    l/=2;
    }
      ans+=l;
    }
    cout<<ans<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:4:6: error: expected initializer before '.' token
    4 | int n.k;
      |      ^
a.cc:5:8: error: 'n' was not declared in this scope
    5 |   cin>>n>>k;
      |        ^
a.cc:5:11: error: 'k' was not declared in this scope
    5 |   cin>>n>>k;
      |           ^
a.cc:9:9: error: 'count' was not declared in this scope
    9 |         count[i]=0;
      |         ^~~~~
a.cc:27:2: error: expected '}' at end of input
   27 | }
      |  ^
a.cc:3:11: note: to match this '{'
    3 | int main(){
      |           ^
Language: C++

#include <iostream>

using namespace std;

int calcTimes(int t, int n, int k) {
	if (n >= k) return 0;
	if (n * 2 >= k) return t + 1;
	return calcTimes(t + 1, n * 2, k);
}

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

	int coinTimes;
	double rate = 0;
	for (int i = 1; i <= n; i++) {
		coinTimes = calcTimes(0, i, k);

		rate += pow(0.5, coinTimes);
	}
	rate /= n;

	cout << rate << endl;

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:20:25: error: 'pow' was not declared in this scope
   20 |                 rate += pow(0.5, coinTimes);
      |                         ^~~
Language: C++

//#include "bits/stdc++.h"
#include "vector"
#include "iostream"
#include <fstream>
#include <string>
#include <iomanip>
using namespace std;
typedef long long ll;
template<class T> bool INRANGE(T x, T a, T b) { return a <= x && x <= b; }
template<class T> inline bool chmin(T& a, T b) {
	if (a > b) {
		a = b;
		return true;
	}
	return false;
}
template<class T> inline bool chmax(T& a, T b) {
	if (a < b) {
		a = b;
		return true;
	}
	return false;
}

#define REP(i,n) for(int i=0;i<(n);++i)
#define RREP(i,n) for(int i=(n);i>=0;--i)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define RFOR(i,a,b) for(int i=(a);i>=(b);--i)
#define ALL(v) (v).begin(),(v).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" \
                      << " " << __FILE__ << endl;


typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<vi> vvi;
typedef pair<int, int> pii;

int main()
{
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	//ifstream in("in.txt");
	//cin.rdbuf(in.rdbuf());

	int N, K;
	cin >> N >> K;
	vector<double> each(N);

	double ans = 0;
	FOR(i, 1, N + 1) {
		
		int score = i;
		int flip_time = 0;
		while (score < K)
		{
			score = score << 1;
			flip_time++;
		}
		ans += pow(0.5, flip_time) / (double)N;
	}

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


Compiler output:
a.cc: In function 'int main()':
a.cc:61:24: error: 'pow' was not declared in this scope
   61 |                 ans += pow(0.5, flip_time) / (double)N;
      |                        ^~~
Language: C

#include <stdio.h>
int main(){
  int dice=0,goal=0;
  int ans=0;
  scanf("%d",&dice);
  scanf("%d",&goal);
  int i=1;
  while(tmp<goal){
    i*=2;
  }
  for(int j=1;j<=dice;j++){
    int tmp=j;
    int son=i;
    while(tmp<goal){
      tmp*=2;
      son/=2;
    }
    ans+=son;
  }
  printf("%lf",(double)ans/i*dice);
  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:8:9: error: 'tmp' undeclared (first use in this function)
    8 |   while(tmp<goal){
      |         ^~~
main.c:8:9: note: each undeclared identifier is reported only once for each function it appears in
Language: C++

/#pragma warning(disable:4996)
#include <stdio.h>
//#include <math.h>

int main() {
	int n, k;
	scanf("%d %d", &n, &k);
	double answer = 0;

	for (int i = 1; i <= n; i++) {
		int a = 1;
		a *= n;
		int b = i;
		while (b <= k) {
			b *= 2;
			a *= 2;
		}
		answer += (double)1 / a;
	}
	printf("%lf", answer);
	//while (1);
}

Compiler output:
a.cc:1:2: error: stray '#' in program
    1 | /#pragma warning(disable:4996)
      |  ^
a.cc:1:1: error: expected unqualified-id before '/' token
    1 | /#pragma warning(disable:4996)
      | ^
a.cc: In function 'int main()':
a.cc:7:9: error: 'scanf' was not declared in this scope
    7 |         scanf("%d %d", &n, &k);
      |         ^~~~~
a.cc:20:9: error: 'printf' was not declared in this scope
   20 |         printf("%lf", answer);
      |         ^~~~~~
a.cc:3:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
    2 | #include <stdio.h>
  +++ |+#include <cstdio>
    3 | //#include <math.h>
Language: C++

#include<iostream>
#include<vector>
#include<string>
#include<stdlib.h>
#include<algorithm>
using namespace std;


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

	double sum = 0;

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

		while (i * pow(2,count) <= K-1)
			count++;

		sum += (1 / N) * (1 / pow(2, count));

	}

	cout << sum << endl;

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:28: error: 'pow' was not declared in this scope
   19 |                 while (i * pow(2,count) <= K-1)
      |                            ^~~
a.cc:22:39: error: 'pow' was not declared in this scope
   22 |                 sum += (1 / N) * (1 / pow(2, count));
      |                                       ^~~
Language: C

#include <stdio.h>

int main(void)
{
	int n,k;
	
	scanf("%d %d",&n,&k);
	
	double ans = 1/(double)n;
	
	double sum = 0;
	
	
	
	for(int i = 1; i <= n; i++){
		temp = i;
		do{
			ans = ans*0.5;
			temp = temp * 2;
		}while(temp < n);
		
		sum = sum + ans;
	}
	
	printf("%lf\n",sum);
	
	return 0;
	
}
		
		
			
			
			
			
			
		
	
	
	

Compiler output:
main.c: In function 'main':
main.c:16:17: error: 'temp' undeclared (first use in this function)
   16 |                 temp = i;
      |                 ^~~~
main.c:16:17: note: each undeclared identifier is reported only once for each function it appears in
Language: C

int main(){
	int N;
  	int K;
  	int i;
  	double	c;
  for(i=0;i<N;i++){
	if(K<i<N){
      c=c+(1/N);
    } even{
      c=c+(1/N)*((1/2)^(K-i+1);
                 }
                 }
                 printf("%f\n",c);
                 return 0;
                 }
                 

Compiler output:
main.c: In function 'main':
main.c:9:7: error: 'even' undeclared (first use in this function)
    9 |     } even{
      |       ^~~~
main.c:9:7: note: each undeclared identifier is reported only once for each function it appears in
main.c:9:11: error: expected ';' before '{' token
    9 |     } even{
      |           ^
      |           ;
main.c:15:18: error: expected declaration or statement at end of input
   15 |                  }
      |                  ^