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


    int tmp;
    double ans = 0.0;

    cin >> n >> k;
    for(int i=1; i<=n; i++){
        if(k%i==0){
            tmp = k/i;
        }else{
            tmp = k/i+1;
        }
        if(log2(tmp)-(int)log2(tmp)==0){
            tmp = (int)log2(tmp);
        }else{
            tmp = (int)log2(tmp)+1;
        }
        ans += 1.0/(double)n*pow(0.5, (double)tmp);
    }
    cout << setprecision(10) << ans << endl;
}

Compiler output:
a.cc:5:5: error: 'cin' does not name a type
    5 |     cin >> n >> k;
      |     ^~~
a.cc:6:5: error: expected unqualified-id before 'for'
    6 |     for(int i=1; i<=n; i++){
      |     ^~~
a.cc:6:18: error: 'i' does not name a type
    6 |     for(int i=1; i<=n; i++){
      |                  ^
a.cc:6:24: error: 'i' does not name a type
    6 |     for(int i=1; i<=n; i++){
      |                        ^
a.cc:19:5: error: 'cout' does not name a type
   19 |     cout << setprecision(10) << ans << endl;
      |     ^~~~
a.cc:20:1: error: expected declaration before '}' token
   20 | }
      | ^
Language: C++

#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <stack>
#include <istream>
#include <map>
#include <set>
#include <queue>
#define rep0(i,n) for (int i = 0; i < (n); ++i)
#define rep1(i,n) for (int i = 1; i < (n); ++i)
#define REP(i,a,b) for (int i = a; i < (b); ++i) 
const long long INF = 10e9 + 7;
typedef long long ll;
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	/*
	/
	/
	/
	*/
	int N, K;
	cin >> N >> K;
	double ans = 0.0;
	REP1(i, N) // サイコロの目が 1, 2, ..., N の場合を試す
	{
		int score = i; // サイコロの出た目が最初の得点
		double div = 1.0;
		while (score < K) // 得点がKより小さい間ループ
		{
			score *= 2; // 得点を2倍
			div /= 2.0;
		}
		ans += div;
	}
	ans /= N;
	printf("%.12f\n", ans);
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:33:14: error: 'i' was not declared in this scope
   33 |         REP1(i, N) // サイコロの目が 1, 2, ..., N の場合を試す
      |              ^
a.cc:33:9: error: 'REP1' was not declared in this scope; did you mean 'REP'?
   33 |         REP1(i, N) // サイコロの目が 1, 2, ..., N の場合を試す
      |         ^~~~
      |         REP
Language: C++

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


Compiler output:
a.cc: In function 'int main()':
a.cc:13:10: error: expected ';' before '}' token
   13 |       h*2
      |          ^
      |          ;
   14 |     }
      |     ~
Language: C++

#include <iostream>
#include <stdio.h>
using namespace std;

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

	int a[100000] = { 0 };
	for (int n = 1; n <= N; n++) {
		int i = 0;
		while (n * pow(2, i) < K) i++;
		a[n - 1] = i;
	}

	double p = 0;
	for (int i = 0; i < N; i++) {
		p += 1 / (pow(2, a[i]));
	}
	p /= N;

	printf("%.10lf\n", p);

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:28: error: 'pow' was not declared in this scope
   13 |                 while (n * pow(2, i) < K) i++;
      |                            ^~~
a.cc:19:27: error: 'pow' was not declared in this scope
   19 |                 p += 1 / (pow(2, a[i]));
      |                           ^~~
Language: C++

#include <iostream>
using namespace std;

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

	int a[100000] = { 0 };
	for (int n = 1; n <= N; n++) {
		int i = 0;
		while (n * pow(2, i) < K) i++;
		a[n - 1] = i;
	}

	double p = 0;
	for (int i = 0; i < N; i++) {
		p += 1 / (pow(2, a[i]));
	}
	p /= N;

	printf("%.10lf\n", p);

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:28: error: 'pow' was not declared in this scope
   12 |                 while (n * pow(2, i) < K) i++;
      |                            ^~~
a.cc:18:27: error: 'pow' was not declared in this scope
   18 |                 p += 1 / (pow(2, a[i]));
      |                           ^~~
Language: C++


        z*=2;
        count++;
      }
      t*=(1/pow(2,count));
      ans+=t;
    }
  }
  cout << ans;
    return 0;
}


Compiler output:
a.cc:2:9: error: 'z' does not name a type
    2 |         z*=2;
      |         ^
a.cc:3:9: error: 'count' does not name a type
    3 |         count++;
      |         ^~~~~
a.cc:4:7: error: expected declaration before '}' token
    4 |       }
      |       ^
a.cc:5:7: error: 't' does not name a type
    5 |       t*=(1/pow(2,count));
      |       ^
a.cc:6:7: error: 'ans' does not name a type
    6 |       ans+=t;
      |       ^~~
a.cc:7:5: error: expected declaration before '}' token
    7 |     }
      |     ^
a.cc:8:3: error: expected declaration before '}' token
    8 |   }
      |   ^
a.cc:9:3: error: 'cout' does not name a type
    9 |   cout << ans;
      |   ^~~~
a.cc:10:5: error: expected unqualified-id before 'return'
   10 |     return 0;
      |     ^~~~~~
a.cc:11:1: error: expected declaration before '}' token
   11 | }
      | ^
Language: C++

#include <iostream>
#include <iomanip>
using namespace std;
int main(){
  //int cnt=0;
  double ans=1.0;
  //double ans=0.0;
  long long N,K; cin>>N>>K;
  for (long long i=1;i<=N;++i){
    long long cnt=i;
    double tmp=1.0;
    while (cnt<K){
      cnt*=2;
      tmp*=(1/2);
    }
    //res*=(1/N);
    ans+=res;
  }
  ans/=N;
  cout<<fixed<<setprecision(10)<<ans<<endl;
}
      
    

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

#include <iostream>
#include <iomanip>
using namespace std;
int main(){
  //int cnt=0;
  double ans=1.0;
  //double ans=0.0;
  long long N,K; cin>>N>>K;
  for (long long i=1;i<=N;++i){
    long long cnt=i;
    double tmp=1.0;
    while (cnt<K){
      cnt*=2;
      temp*=(1/2);
    }
    //res*=(1/N);
    ans+=res;
  }
  ans/=n;
  cout<<fixed<<setprecision(10)<<ans<<endl;
}
      
    

Compiler output:
a.cc: In function 'int main()':
a.cc:14:7: error: 'temp' was not declared in this scope; did you mean 'tmp'?
   14 |       temp*=(1/2);
      |       ^~~~
      |       tmp
a.cc:17:10: error: 'res' was not declared in this scope
   17 |     ans+=res;
      |          ^~~
a.cc:19:8: error: 'n' was not declared in this scope
   19 |   ans/=n;
      |        ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define SORT(c) sort((c).begin(),(c).end())
#define REVERSE(c) reverse((c).begin(),(c).end())
#define ALL(x) (x).begin(),(x).end()
const long long MOD = 1000000007;
const long long INF = 1LL << 60;

int main(){
	int N, K;
	scanf("%d%d", &N, &K);
	double ans = 0;
	
	for(int i = 1; i <= N; i++){
		int Point  = i;
		double rate = 1.0 / N;
		while(Point < K){
			Point *= 2;
			rate *= 0.5
		}
		ans += rate;
	}
	
	printf("%.12f\n", ans);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:20:36: error: expected ';' before '}' token
   20 |                         rate *= 0.5
      |                                    ^
      |                                    ;
   21 |                 }
      |                 ~
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define SORT(c) sort((c).begin(),(c).end())
#define REVERSE(c) reverse((c).begin(),(c).end())
#define ALL(x) (x).begin(),(x).end()
const long long MOD = 1000000007;
const long long INF = 1LL << 60;

int main(){
	int N, K;
	scanf("%d%d", N, K);
	double ans = 0;
	
	for(int i = 1; i <= N; i++){
		int Point  = i;
		double rate = 1.0 / N;
		while(Point < K){
			Point *= 2;
			rate *= 0.5
		}
		ans += rate;
	}
	
	printf("%.12f\n", ans);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:20:36: error: expected ';' before '}' token
   20 |                         rate *= 0.5
      |                                    ^
      |                                    ;
   21 |                 }
      |                 ~
Language: C

N, K = list(map(int, input().split()))
pro = 0.0
for i in range(1, N + 1):
    mul = i
    count = 0
    while mul < K:
        mul *= 2
        count += 1
    pro += (1 / N) * ((1 / 2) ** count)
print('{:.10f}'.format(pro))

Compiler output:
main.c:1:1: warning: data definition has no type or storage class
    1 | N, K = list(map(int, input().split()))
      | ^
main.c:1:1: error: type defaults to 'int' in declaration of 'N' [-Wimplicit-int]
main.c:1:4: error: type defaults to 'int' in declaration of 'K' [-Wimplicit-int]
    1 | N, K = list(map(int, input().split()))
      |    ^
main.c:1:8: error: implicit declaration of function 'list' [-Wimplicit-function-declaration]
    1 | N, K = list(map(int, input().split()))
      |        ^~~~
main.c:1:13: error: implicit declaration of function 'map' [-Wimplicit-function-declaration]
    1 | N, K = list(map(int, input().split()))
      |             ^~~
main.c:1:17: error: expected expression before 'int'
    1 | N, K = list(map(int, input().split()))
      |                 ^~~
main.c:2:1: error: expected ',' or ';' before 'pro'
    2 | pro = 0.0
      | ^~~
main.c:10:7: warning: multi-character literal with 7 characters exceeds 'int' size of 4 bytes
   10 | print('{:.10f}'.format(pro))
      |       ^~~~~~~~~
Language: C++

#inlude <bits/stdc++.h>
using namespace std;
using ll=long long;

int main(){
	double N;
	double K;
	cin>>N>>K;
	double answer=0;
	for(double i=1;i<=N;i++){
		double now=i;
		double p=1.0/N;
		while(now<K){
			now*=2;
			p/=2;
		}
		answer+=p;
	}
	cout<<answer<<endl;
	return 0;
}


Compiler output:
a.cc:1:2: error: invalid preprocessing directive #inlude; did you mean #include?
    1 | #inlude <bits/stdc++.h>
      |  ^~~~~~
      |  include
a.cc: In function 'int main()':
a.cc:8:9: error: 'cin' was not declared in this scope
    8 |         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 | #inlude <bits/stdc++.h>
a.cc:19:9: error: 'cout' was not declared in this scope
   19 |         cout<<answer<<endl;
      |         ^~~~
a.cc:19:9: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:19:23: error: 'endl' was not declared in this scope
   19 |         cout<<answer<<endl;
      |                       ^~~~
a.cc:1:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
  +++ |+#include <ostream>
    1 | #inlude <bits/stdc++.h>
Language: C++

#include <iostream>
#include <cmath>
using namespace std;
using ll=long long;

int main(){
	double N;
	double K;
	cin>>N>>K;
	double answer=0;
	for(double i=1;i<=N;i++){
		double t=0;
		double p=(double)1/N;
		while(i*pow((double)2,t)<K){
			t++;
		}
		p*=pow((double)1/(double)3,t);
		answer+=p;
	}
	cout<<answer<<endl;
	return 0;
}
d

Compiler output:
a.cc:23:1: error: 'd' does not name a type
   23 | d
      | ^
Language: C++

#include <iostream>
using namespace std;
using ll=long long;

int main(){
	double N;
	double K;
	cin>>N>>K;
	double answer=0;
	for(double i=1;i<=N;i++){
		double t=0;
		double p=1/N;
		while(i*pow(2,t)<K){
			t++;
		}
		p*=pow(0.5,t);
		answer+=p;
	}
	cout<<answer<<endl;
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:13:25: error: 'pow' was not declared in this scope
   13 |                 while(i*pow(2,t)<K){
      |                         ^~~
a.cc:16:20: error: 'pow' was not declared in this scope
   16 |                 p*=pow(0.5,t);
      |                    ^~~
Language: C++

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

int main(){
  int n, k;
  cin >> n >> k;
  double ans;
  rep(i,n){
    int tmp;
    tmp = log(k/i)/1
    ans += 1/n * pow(0.5,(tmp+1));
  }
  cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:21: error: expected ';' before 'ans'
   11 |     tmp = log(k/i)/1
      |                     ^
      |                     ;
   12 |     ans += 1/n * pow(0.5,(tmp+1));
      |     ~~~
Language: C++

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

using namespace std;

int main()
{
	int N, K;

	cin >> N >> K;

	double R = 0;
	for ( int d = 1; d <= N; d ++ ) {
		int b = 1;
		int a = 0;
		while ( 1 ) {
			if ( (d * (b << a) ) > K ) break;
			a ++;
		}
// cout << d << ":" <<  a << endl;

		double r;
		r = 1.0 / N;
		r *= pow( 0.5, a );
// cout << r << endl;
		R+= r;
	}

	cout.precision(10);
	cout << R << endl;

    return 0;
}



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

#include <bits/stdc++.h>
using namespace std;
int main (){
  doupble N;
  int K;
  cin >>N>>K;
  int s;
  double p;
  for (int i=1;i<N+1;i++){
    if (i>K-1){
      p+=1/N;
    }
    else{
  p+=1/N*pow(1/2.0,K/(2*i)+1.0);
  }
  }
  printf("%.12f\n",p);
  }

Compiler output:
a.cc: In function 'int main()':
a.cc:4:3: error: 'doupble' was not declared in this scope; did you mean 'double'?
    4 |   doupble N;
      |   ^~~~~~~
      |   double
a.cc:6:9: error: 'N' was not declared in this scope
    6 |   cin >>N>>K;
      |         ^
Language: C++

#include <bits/stdc++.h>

#define mod 1000000007

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

using namespace std;
typedef long long ll; 
 
int main(void){
	
	int N, K;
	double ans = 0;
	
	cin >> N >> K;
	
	rep(i, N){
		double tmp = 1.0 / N;
		int score = i;
		while(score < K){
			score *= 2;
			tmp /= 2;
		}
		ans += tmp;
	}
	
	cout << tmp;
	
	return 0;
}

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

#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <map>
#define rep(i, n) for(int i=0;i<n;i++)
typedef long long ll;
#define intv vector<v>
#define llv vector<long long>
#define intvv vector<vector<int>>
#define llvv vector<vector<long long>>
using namespace std;


int main(){
    int n, k;
    cin >> n >> k;
    double ans = 0;
    for(int i=1;i<=n;i++){
        double temp = 1.0 / n;
        int j = i;
        while(j < k){
            j *= 2;
            temp /= 2;
        }
        ans += temp;
    }
	scanf("%.12f\n", ans)
}

Compiler output:
a.cc: In function 'int main()':
a.cc:29:30: error: expected ';' before '}' token
   29 |         scanf("%.12f\n", ans)
      |                              ^
      |                              ;
   30 | }
      | ~
Language: C++

#include<cmath>
#include<iomanip>

using namespace std;

int main(){
    int N, K;
    cin >> N >> K;
    double ret = 0;
    double temp = 1.0/N;
    for(int i=1;i<=N;i++){
        int now = i;
        temp = 1.0/N;
        while( now < K ){
            now *= 2;
            temp /=2;
        }
        ret += temp;
    }
    cout << setprecision(9) << ret <<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:3:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    2 | #include<iomanip>
  +++ |+#include <iostream>
    3 | 
a.cc:20:5: error: 'cout' was not declared in this scope
   20 |     cout << setprecision(9) << ret <<endl;
      |     ^~~~
a.cc:20:5: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
Language: C++

;; 126 C - Dice and Coin
(define n (read))
(define k (read))
(define (main arg)
  (let loop ((k k) (s 0) (b 1) (prev (+ n 1)))
    (if (= k 1) (format #t "~d" (inexact (/ (+ b s) n)))
	(loop (div (+ k 1) 2) (+ s (* b (max 0 (- prev k)))) (/ b 2) (min prev k))))
  0)

Compiler output:
a.cc:6:25: error: stray '#' in program
    6 |     (if (= k 1) (format #t "~d" (inexact (/ (+ b s) n)))
      |                         ^
a.cc:1:4: error: expected unqualified-id before numeric constant
    1 | ;; 126 C - Dice and Coin
      |    ^~~
Language: C++

#include<bits/stdc++.h>
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
ll gcd(ll a,ll b){return b!=0?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a*b/gcd(a,b);}

int main(){
    ll n,k,pw=1;
    cin>>n>>k;
    double p;
    p=max(0,n-k+1);
    for(ll i=k;;i=(i+1)/2,pw++){
        p+=(i-(i+1)/2)*pow(1/2,pw);
        if(i==1) break;
    }
    cout<<fixed<<setprecision(9)<<p/n<<endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:10: error: no matching function for call to 'max(int, ll)'
   12 |     p=max(0,n-k+1);
      |       ~~~^~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   template argument deduction/substitution failed:
a.cc:12:10: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'll' {aka 'long long int'})
   12 |     p=max(0,n-k+1);
      |       ~~~^~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note:   template argument deduction/substitution failed:
a.cc:12:10: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   12 |     p=max(0,n-k+1);
      |       ~~~^~~~~~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll MOD = 1e9 + 7;


// ABC126A - Dice and Coin
// https://atcoder.jp/contests/abc126/tasks/abc126_c
void ABC126C() {
	int N, K;
	cin >> N >> K;

	double ans = 0.0;
	for (int i = 1; i <= N; i++)
	{
		//得点Kを超えるのに必要な表を出す回数
		int times;
		if (K <= i) {
			times = 0; //一度も振らなくても勝てる
		}
		else {
			times = (int)ceil(log2(K / i)); // N * 2^x >= K なら勝ちなので、振る回数xを求める
		}
		//cout << times << endl;
		
		double hoge = 1.0;
		for (int j = 0; j < times; j++)
		{
			hoge *= 0.5;
		}
		ans += hoge;
	}

	double tmp = double(1.0 / (double)N); //1～Nのいずれかが出る確率
	printf("%.12f\n", ans*tmp);
}

Compiler output:
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x17): undefined reference to `main'
collect2: error: ld returned 1 exit status
Language: C++

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

int main(){
	int N, K;
	cin >> N >> K;
	double count = 0;
	double win = 0;
	
	for(int i = 1; i <= N; i++){
		int point = i;
		double winrate = 1 / 2:
		
		while(point < K){
			point *= 2;
			winrate *= 1 / 2;
		}
		
		win += winrate;
	}
	
	cout << win << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:39: error: expected ',' or ';' before ':' token
   12 |                 double winrate = 1 / 2:
      |                                       ^
Language: C++

include <bits/stdc++.h>
#define rep(i,n) for(int (i)=1;(i)<=(n);(i)++)
using namespace std;
int main() {

  cout << fixed << setprecision(20);//結果が20桁で表示される

  int N, M; cin >> N >> M;
  double p=0;

  rep(i,N) {
    double temp = 1.0/N;
    int now = i;
    while (now < M){
      now *= 2;
      temp /= 2;
    }
    p += temp;
  }
  cout << p << endl;
  return 0;
}

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:3: error: 'cout' was not declared in this scope
    6 |   cout << fixed << setprecision(20);//結果が20桁で表示される
      |   ^~~~
a.cc:6:11: error: 'fixed' was not declared in this scope
    6 |   cout << fixed << setprecision(20);//結果が20桁で表示される
      |           ^~~~~
a.cc:6:20: error: 'setprecision' was not declared in this scope
    6 |   cout << fixed << setprecision(20);//結果が20桁で表示される
      |                    ^~~~~~~~~~~~
a.cc:8:13: error: 'cin' was not declared in this scope
    8 |   int N, M; cin >> N >> M;
      |             ^~~
a.cc:20:16: error: 'endl' was not declared in this scope
   20 |   cout << p << endl;
      |                ^~~~
Language: C++

import numpy as np

n = int(input())
k = int(input())
ans = np.zeros(n)

for i in range(n):
    ans[i] = 1.0

for i in range(n):
    tmp = i+1
    while(tmp < k):
        ans[i]*=0.5
        tmp*=2


print(np.sum(ans)/n)

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

include <bits/stdc++.h>
#define rep(i,n) for(int (i)=1;(i)<=(n);(i)++)
using namespace std;
int main() {
  int N, M; cin >> N >> N;
  double p=0;
  
  rep(i,N) {
    double temp = 1.0/N;
    int now = i;
    while (now < M){
      now *= 2;
      temp /= 2;
    }
    p += temp;
  }
  std::cout << ret << endl;
  return 0;
}
    
    
      
    

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:5:13: error: 'cin' was not declared in this scope
    5 |   int N, M; cin >> N >> N;
      |             ^~~
a.cc:17:8: error: 'cout' is not a member of 'std'
   17 |   std::cout << ret << endl;
      |        ^~~~
a.cc:1:1: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
  +++ |+#include <iostream>
    1 | include <bits/stdc++.h>
a.cc:17:16: error: 'ret' was not declared in this scope; did you mean 'rep'?
   17 |   std::cout << ret << endl;
      |                ^~~
      |                rep
a.cc:17:23: error: 'endl' was not declared in this scope
   17 |   std::cout << ret << endl;
      |                       ^~~~
Language: C++

include <bits/stdc++.h>
#define rep(i,n) for(int (i)=1;(i)<=(n);(i)++)
using namespace std;
int main() {
  int N, M; cin >> N >> N;
  double p=0;
  
  rep(i,N) {
    double temp = 1.0/N;
    int now = i;
    while (now < M){
      now *= 2;
      temp /= 2;
    }
    ret += temp;
  }
  std::cout << ret << endl;
  return 0;
}
    
    
      
    

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:5:13: error: 'cin' was not declared in this scope
    5 |   int N, M; cin >> N >> N;
      |             ^~~
a.cc:15:5: error: 'ret' was not declared in this scope; did you mean 'rep'?
   15 |     ret += temp;
      |     ^~~
      |     rep
a.cc:17:8: error: 'cout' is not a member of 'std'
   17 |   std::cout << ret << endl;
      |        ^~~~
a.cc:1:1: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
  +++ |+#include <iostream>
    1 | include <bits/stdc++.h>
a.cc:17:16: error: 'ret' was not declared in this scope; did you mean 'rep'?
   17 |   std::cout << ret << endl;
      |                ^~~
      |                rep
a.cc:17:23: error: 'endl' was not declared in this scope
   17 |   std::cout << ret << endl;
      |                       ^~~~
Language: C++

include <bits/stdc++.h>
#define rep(i,n) for(int (i)=1;(i)<=(n);(i)++)
using namespace std;
int main() {
  int N, M; cin >> N >> N;
  double p=0;
  
  rep(i,N) {
    double temp = 1.0/N;
    int now = i;
    while (now < M){
      now *= 2;
      temp /= 2;
    }
    ret += temp;
  }
  cout << ret << endl;
  return 0;
}
    
    
      
    

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:5:13: error: 'cin' was not declared in this scope
    5 |   int N, M; cin >> N >> N;
      |             ^~~
a.cc:15:5: error: 'ret' was not declared in this scope; did you mean 'rep'?
   15 |     ret += temp;
      |     ^~~
      |     rep
a.cc:17:3: error: 'cout' was not declared in this scope
   17 |   cout << ret << endl;
      |   ^~~~
a.cc:17:11: error: 'ret' was not declared in this scope; did you mean 'rep'?
   17 |   cout << ret << endl;
      |           ^~~
      |           rep
a.cc:17:18: error: 'endl' was not declared in this scope
   17 |   cout << ret << endl;
      |                  ^~~~
Language: C++

include <bits/stdc++.h>
#define rep(i,n) for(int (i)=1;(i)<=(n);(i)++)
using namespace std;
int main() {
  int N, M; cin >> N >> N;
  double p=0;
  
  rep(i,N) {
    double temp = 1.0/N;
    int now = i;
    while (now < M){
      now *= 2;
      temp /= 2;
    }
    ret += temp;
  
  cout << ret << endl;
  return 0;
}
    
    
      
    

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:5:13: error: 'cin' was not declared in this scope
    5 |   int N, M; cin >> N >> N;
      |             ^~~
a.cc:15:5: error: 'ret' was not declared in this scope; did you mean 'rep'?
   15 |     ret += temp;
      |     ^~~
      |     rep
a.cc:17:3: error: 'cout' was not declared in this scope
   17 |   cout << ret << endl;
      |   ^~~~
a.cc:17:18: error: 'endl' was not declared in this scope
   17 |   cout << ret << endl;
      |                  ^~~~
a.cc:19:2: error: expected '}' at end of input
   19 | }
      |  ^
a.cc:4:12: note: to match this '{'
    4 | int main() {
      |            ^
Language: C++

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

int K;

int count(int n)
{
	int cnt = 0;
	int sum = n;
	while (sum < K)
	{
		sum = sum * 2;
		cnt++;
	}

	return pow(2, cnt);
}

int main()
{
	int N;
	cin >> N >> K;
    
	int sum = 0;
	int cnt = 0;
	double ans = 0;	
	vector<int> list(N);
	for (int i = 1; i <= N; i++)
	{
		ans += 1.0 / (count(i) * N);
	}

	cout << ans << endl;

	return 0;
}

Compiler output:
a.cc: In function 'int count(int)':
a.cc:21:16: error: 'pow' was not declared in this scope
   21 |         return pow(2, cnt);
      |                ^~~
Language: C++

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

int main() {
  int N;
  cin >> N;
  int Z;
  Z = 0;
  int H;
  int A;
  A = 0;
  int K;
  cin >> K;
  for (int i = 0; i < N; i++) {
    H = 1;
    A = A + 1;
    for (H * A < K;) {
      H = H * 2;
    }
    H = 1 / H;
    Z = Z + H;
  }
  Z = Z / N;
  cout << Z << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:20: error: expected primary-expression before ')' token
   17 |     for (H * A < K;) {
      |                    ^
a.cc:17:20: error: expected ';' before ')' token
   17 |     for (H * A < K;) {
      |                    ^
      |                    ;
Language: C++

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

int main() {
  int N;
  cin >> N;
  int Z;
  Z = 0;
  int H;
  int A;
  A = 0;
  int K;
  cin >> K;
  for (int i = 0; i < N; i++) {
    H = 1;
    A = A + 1;
    for (H * A < K; ) {
      H = H * 2;
    }
    H = 1 / H;
    Z = Z + H;
  }
  Z = Z / N;
  cout << Z << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:21: error: expected primary-expression before ')' token
   17 |     for (H * A < K; ) {
      |                     ^
a.cc:17:20: error: expected ';' before ')' token
   17 |     for (H * A < K; ) {
      |                    ^~
      |                    ;
Language: C++

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

int main() {
  int N;
  cin >> N;
  int Z;
  Z = 0;
  int H;
  int A;
  A = 0;
  int K;
  cin >> K;
  for (int i = 0; i < N; i++) {
    H = 1;
    A = A + 1;
    for (H * A < K ) {
      H = H * 2;
    }
    H = 1 / H;
    Z = Z + H;
  }
  Z = Z / N;
  cout << Z << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:19: error: expected ';' before ')' token
   17 |     for (H * A < K ) {
      |                   ^~
      |                   ;
a.cc:21:14: error: expected ')' before ';' token
   21 |     Z = Z + H;
      |              ^
      |              )
a.cc:17:9: note: to match this '('
   17 |     for (H * A < K ) {
      |         ^
Language: C++

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

int main() {
  int N;
  cin >> N;
  int Z;
  Z = 0;
  int H;
  int A;
  A = 0;
  int K;
  cin >> K;
  for (int i = 0; i < N; i++) {
    H = 1;
    A = A + 1;
    for(H * A < K;) {
      H = H * 2;
    }
    H = 1 / H;
    Z = Z + H;
  }
  Z = Z / N;
  cout << Z << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:19: error: expected primary-expression before ')' token
   17 |     for(H * A < K;) {
      |                   ^
a.cc:17:19: error: expected ';' before ')' token
   17 |     for(H * A < K;) {
      |                   ^
      |                   ;
Language: C++

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

int main() {
  int N;
  cin >> N;
  int Z;
  Z = 0;
  int H;
  int A;
  A = 0;
  int K;
  cin >> K;
  for (int i = 0; i < N; i++) {
    H = 1;
    A = A + 1;
    for(H * A < K) {
      H = H * 2;
    }
    H = 1 / H;
    Z = Z + H;
  }
  Z = Z / N;
  cout << Z << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:18: error: expected ';' before ')' token
   17 |     for(H * A < K) {
      |                  ^
      |                  ;
a.cc:21:14: error: expected ')' before ';' token
   21 |     Z = Z + H;
      |              ^
      |              )
a.cc:17:8: note: to match this '('
   17 |     for(H * A < K) {
      |        ^
Language: C++

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

int main() {
  int N;
  cin >> N;
  int Z;
  Z = 0;
  int H;
  int A;
  A = 0;
  int K;
  cin >> K;
  for (int i = 0; i < N; i++) {
    H = 1;
    A = A + 1;
    for(H * A < K) {
      H = H * 2;
    }
  H = 1 / H;
  Z = Z + H;
  }
  Z = Z / N;
  cout << Z << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:18: error: expected ';' before ')' token
   17 |     for(H * A < K) {
      |                  ^
      |                  ;
a.cc:21:12: error: expected ')' before ';' token
   21 |   Z = Z + H;
      |            ^
      |            )
a.cc:17:8: note: to match this '('
   17 |     for(H * A < K) {
      |        ^
Language: C++

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

int main() {
  int N;
  cin >> N;
  int Z;
  Z = 0;
  int H;
  int A;
  A = 0;
  int K;
  cin >> K;
  for (int i = 0; i < N; i++) {
    H = 1;
    A = A + 1;
    for(H * A < K;) {
      H = H * 2;
    }
  H = 1 / H;
  Z = Z + H;
  }
  Z = Z / N;
  cout << Z << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:19: error: expected primary-expression before ')' token
   17 |     for(H * A < K;) {
      |                   ^
a.cc:17:19: error: expected ';' before ')' token
   17 |     for(H * A < K;) {
      |                   ^
      |                   ;
Language: C++

#define _USE_NATH_DEFINES
#include<cstdio>
#include <iostream>
#include<sstream>
#include<fstream>
#include<iomanip>
#include<algorithm>
#include<cmath>
#include<complex>
#include <string>
#include<vector>
#include<list>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<bitset>
#include<numeric>
#include<limits>
#include<climits>
#include<cfloat>
#include<functional>
#include<iterator>
#include <random>
#define REP(i,m,n) for(int i=(int)m ; i < (int) n ; ++i )
#define rep(i,n) REP(i,0,n)
using namespace std;

#define INF 100000000


int main() {
	int a, b;
	cin >> 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;
	}
	cout MM ret << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:45:13: error: expected ';' before 'MM'
   45 |         cout MM ret << endl;
      |             ^~~
      |             ;
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main(){
  int n,k;cin>>n>>k;
  double ans=0.0;
  //初期値でK以上となる場合があるとき
  if(n>=k)ans+=(n-k+1)/n;
  cerr<<ans<<endl;
  //初期値が1~K-1のとき
  //天井[log2(n/初期値)]回連続して表が出る必要がある
  for(int i=1;i<=min(k-1,n);i++){
    ans+=(1/(pow(2,ceil(log2(k)-log2(i)))/n);
    cerr<<ceil(log2(k/i))<<' ';
  }
  cout<<ans;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:12:45: error: expected ')' before ';' token
   12 |     ans+=(1/(pow(2,ceil(log2(k)-log2(i)))/n);
      |          ~                                  ^
      |                                             )
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main(){
  int n,k;cin>>n>>k;
  double ans=0.0;
  //初期値でK以上となる場合があるとき
  if(n>=k)ans+=(n-k+1)/n;
  cerr<<ans<<endl;
  //初期値が1~K-1のとき
  //天井[log2(n/初期値)]回連続して表が出る必要がある
  for(int i=1;i<=min(k-1,n);i++){
    ans+=(1/(pow(2,ceil(log2(k)-log2(i)))n);
    cerr<<ceil(log2(k/i))<<' ';
  }
  cout<<ans;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:12:42: error: expected ')' before 'n'
   12 |     ans+=(1/(pow(2,ceil(log2(k)-log2(i)))n);
      |             ~                            ^
      |                                          )
a.cc:12:44: error: expected ')' before ';' token
   12 |     ans+=(1/(pow(2,ceil(log2(k)-log2(i)))n);
      |          ~                                 ^
      |                                            )
Language: C++

#include <iostream>
#include <string>
#include <algorithm>
#include <map>
#include <cmath>
#include <numeric>
#include <vector>
#include <bitset>
#include <queue>
using namespace std;

int main(){
    // long long N, K;
    // cin >> N >> K;
    // long long tmpmax = N;
    // long long tmpmin = K-1;
    // double ans = 0;
    // if(N > K){
    //     ans += N - (K-1);
    // }
    // long long time = 1;
    // while(true){
    //     if(tmpmin == 0){
    //         break;
    //     }
    //     tmpmax = min(tmpmin, N);
    //     tmpmin = (K-1) / pow(2, time);
    //     if(tmpmax > tmpmin){
    //         ans += (tmpmax - tmpmin)/pow(2.0, time);
    //         //cout << tmpmin << endl;
    //     }
    //     time++;
    //     if(tmpmin == 0){
    //         break;
    //     }
    // }
    // ans /= N;
    // printf("%.10f\n", ans);
    // return 0;
    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: In function 'int main()':
a.cc:40:13: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
   40 |     int main(){
      |             ^~
a.cc:40:13: note: remove parentheses to default-initialize a variable
   40 |     int main(){
      |             ^~
      |             --
a.cc:40:13: note: or replace parentheses with braces to value-initialize a variable
a.cc:40:15: error: a function-definition is not allowed here before '{' token
   40 |     int main(){
      |               ^
Language: C++

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: In function 'int main()':
a.cc:2:9: error: 'scanf' was not declared in this scope
    2 | int a,b;scanf("%d%d",&a,&b);
      |         ^~~~~
a.cc:13:1: error: 'printf' was not declared in this scope
   13 | printf("%.12f\n",ret);
      | ^~~~~~
a.cc:1:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
  +++ |+#include <cstdio>
    1 | int main(){
Language: C++

#include<iostream>
#inclued<cstdio>
using namespace std;
int main(){
  	int N,K;
  	double ans;
  	double number = 1;
    int i;
    cin >> N >> K;
  
  	ans = 0;
  	for(i=K;i>=1;i--){
      	while( i * number < K){
			number *= 2;
        }
        ans += 1/number;
    }
  	ans *= 1/(float)N;
  
    printf("%10lf\n",ans);
}

Compiler output:
a.cc:2:2: error: invalid preprocessing directive #inclued; did you mean #include?
    2 | #inclued<cstdio>
      |  ^~~~~~~
      |  include
Language: C++

#include<iostream>
#inclued<cstdio>
using namespace std;
int main(){
  	int N,K;
  	double ans;
  	double number = 1;
    int i;
    cin >> N >> K;
  
  	ans = 0;
  	for(i=K;i>=1;i--){
      	while( i * number < K){
			number *= 2;
        }
        ans += 1/number;
    }
  	ans * = 1/(float)N;
  
    printf("%10lf\n",ans);
}

Compiler output:
a.cc:2:2: error: invalid preprocessing directive #inclued; did you mean #include?
    2 | #inclued<cstdio>
      |  ^~~~~~~
      |  include
a.cc: In function 'int main()':
a.cc:18:15: error: expected primary-expression before '=' token
   18 |         ans * = 1/(float)N;
      |               ^
Language: C++

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

int main(){
  int n,k; cin >> n >> k;
  double score=0;
  for(int i=1;i<=n;i++){ 
    int a = i;
    s = 1.0/n;
 	 do{
    	a*=2;
    	s/=2;
  	}while(a<k);
    score += s;
  }
  cout << score << endl;
}
    
  

Compiler output:
a.cc: In function 'int main()':
a.cc:9:5: error: 's' was not declared in this scope
    9 |     s = 1.0/n;
      |     ^
Language: C++

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

int main(){
  int n,k; cin >> n >> k;
  double score=0;
  for(int i=1;i<=n;i++){ 
    int a + i;
    s = 1.0/n;
 	 do{
    	a*=2;
    	s/=2;
  	}while(a<k);
    score += s;
  }
  cout << score << endl;
}
    
  

Compiler output:
a.cc: In function 'int main()':
a.cc:8:11: error: expected initializer before '+' token
    8 |     int a + i;
      |           ^
a.cc:9:5: error: 's' was not declared in this scope
    9 |     s = 1.0/n;
      |     ^
a.cc:11:9: error: 'a' was not declared in this scope
   11 |         a*=2;
      |         ^
a.cc:13:16: error: 'a' was not declared in this scope
   13 |         }while(a<k);
      |                ^
Language: C++

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

int main(){
  int n,i,a=0,k; cin >> n >> k;
  double s=0,score=0;
  for(i=1;i<=n;i++){ 
    a = i;
 	 do{
    	a*=2;
    	s++;
  	}while(a<k);
    score += 0.5**s;
    s=0;
  }
  cout << score << endl;
}
    
  

Compiler output:
a.cc: In function 'int main()':
a.cc:13:18: error: invalid type argument of unary '*' (have 'double')
   13 |     score += 0.5**s;
      |                  ^~
Language: C++

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

int main(){
  int n,i,a=0,k;s=0,score=0; cin >> n >> k;
  for(i=1;i<=n;i++){ 
 	 do{
    	a*=2;
    	s++;
  	}while(a<k);
    score += 0.5**s;
    s=0;
  }
  cout << score << endl;
}
    
  

Compiler output:
a.cc: In function 'int main()':
a.cc:5:17: error: 's' was not declared in this scope
    5 |   int n,i,a=0,k;s=0,score=0; cin >> n >> k;
      |                 ^
a.cc:5:21: error: 'score' was not declared in this scope
    5 |   int n,i,a=0,k;s=0,score=0; cin >> n >> k;
      |                     ^~~~~
Language: C++

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

int main(){
  int n,i,a=0,k;s=0,score=0; cin >> n >> k;
  for(i=1;i<=n;i++){ 
 	 do{
    	a*=2;
    	s++;
  	}while(a<k);
    score += 0.5**s;
    s=0;
  }
  cout << score << 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<stdc++.h>
using namespace std;

int main(){
  int n,i,k;s=0,score=0; cin >> n >> k;
  for(i=1;i<=n;i++){ 
 	 do{
    	i*=2;
    	s++;
  	}while(i<k);
    score += 0.5**s;
    s=0;
  }
  cout << score << endl;
}
    
  

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

n, k = map(int, input().split())
sum = 0
coin_count = 0


for i in range(n):
    k = coin(i, k)
    sum += (1/n) * ((0.5) ** k)

print(sum)


def coin(j,k):
    point = j
    count = 0
    while k <= point:
        point = point * 2
        count += 1
    return count


Compiler output:
a.cc:1:1: error: 'n' does not name a type
    1 | n, k = map(int, input().split())
      | ^
Language: C++

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

using namespace std;
int main() {
  int N, K, calc, cnt;
  cin >> N >> K;
  double ans;
  ans = 0;
  for (int i = 1; i <= N; i++) {
    calc = i;
    cnt = 0;
    while (calc < K) {
      calc = calc * 2;
      cnt++;
    }
    if (cnt == 0) {
      ans += 1 / (double)N;
    } else {
      ans = ans + ((1 / (double)N) * (1 / pow(2, cnt)));
    }
  }
  cout << std::fixed << std::setprecision(12) << ans << endl;
  return 0;
}


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

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

using namespace std;
int main() {
  int N, K, calc, cnt;
  cin >> N >> K;
  double ans;
  ans = 0;
  for (int i = 1; i <= N; i++) {
    calc = i;
    cnt = 0;
    while (calc < K) {
      calc = calc * 2;
      cnt++;
    }
    if (cnt == 0) {
      ans += 1;
    } else {
      ans = ans + ((1 / (double)N) * (1 / pow(2, cnt)));
    }
  }
  cout << std::fixed << std::setprecision(12) << ans << endl;
  return 0;
}


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

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

using namespace std;
int main() {
  int N, K, calc, cnt;
  cin >> N >> K;
  double ans;
  ans = 0;
  for (int i = 1; i <= N; i++) {
    calc = i;
    cnt = 0;
    while (true) {
      if (calc >= K) {
        break;
      }
      calc = calc * 2;
      cnt++;
    }
    ans = ans + ((1 / (double)N) * (1 / pow(2, cnt)));
  }
  cout << std::fixed << std::setprecision(12) << ans << endl;
  return 0;
}


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

#include <bits/stdc++.h>
using namespace std;
double dice(int i,int K){
    int k = i;
    int count = 0;
    while(k < K){
        k = k*2;
        count++;
    }
    //cout << pow(0.5,count) << endl;
    return pow(0.5, count);
}

Compiler output:
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x17): undefined reference to `main'
collect2: error: ld returned 1 exit status
Language: C++

#include<iostrream>
using namespace std;
int main(){
	int n,k;	cin >> n >> k;
	double ans=0;
	for(int i=1;i<=n;i++){
		double p = 1.0/n;
		int now = i;
		while(now<k){
			now *= 2;
			p *= 0.5;
		}
		ans += p;
	}
	cout << p << endl;
	return 0;
}

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

#include <iostream>
#include <algorithm>
using namespace std;
int main(){
  int n, k, i, sum=0;
  cin >> n >>k;
  for(i=1; i<=n; i++){
    sum+=pow(0.5,ceil(log2(1.0*k/i)))/n;}
  cout << sum;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:23: error: 'log2' was not declared in this scope
    8 |     sum+=pow(0.5,ceil(log2(1.0*k/i)))/n;}
      |                       ^~~~
a.cc:8:18: error: 'ceil' was not declared in this scope
    8 |     sum+=pow(0.5,ceil(log2(1.0*k/i)))/n;}
      |                  ^~~~
a.cc:8:10: error: 'pow' was not declared in this scope
    8 |     sum+=pow(0.5,ceil(log2(1.0*k/i)))/n;}
      |          ^~~
Language: C++

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

int main()
{
	int n,k,ans=0;
	scanf("%d%d",&n,&k);
	double ans=0;
	for(int i=1;i<=n;++i)
	{
      	double prob=1.0/n;
        int score=i;
        while(score<k){
        	score*=2;
            prob/=2;
        }
        ans+=prob;
     }
     printf("%.12f\n",ans);
     return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:16: error: conflicting declaration 'double ans'
    8 |         double ans=0;
      |                ^~~
a.cc:6:17: note: previous declaration as 'int ans'
    6 |         int n,k,ans=0;
      |                 ^~~
Language: C++

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

int main()
{
   int n,k,ans=0;
   scanf("%d%d",&n,&k);
   double ans=0;
   for(int i=1;i<=n;++i)
   {
       double prob=1.0/n;
        int score=i;
        while(score<k){
            score*=2;
             prob/=2;
           }
            ans+=prob;
     }
     printf("%.12f\n",ans);
     return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:11: error: conflicting declaration 'double ans'
    8 |    double ans=0;
      |           ^~~
a.cc:6:12: note: previous declaration as 'int ans'
    6 |    int n,k,ans=0;
      |            ^~~
Language: C++

#include <bits/stdc++.h>
#define repd(i, a, b) for (int i = (a); i < (b); i++)
#define rep(i, n) repd(i, 0, n)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
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;
}

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

    repd(i, 1, N + 1)
    {
        double eq = N;
        if (i < K)
        {
            long double z = log(K / i) / log((long double)2.0);
            eq = (N * pow(2, ceil(z)));
        }
        ans += ((long double)1.0 / eq);
    }

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


Compiler output:
a.cc:33:4: error: extended character 　 is not valid in an identifier
   33 |    　double ans = 0;
      |    ^
a.cc: In function 'int main()':
a.cc:33:4: error: '\U00003000double' was not declared in this scope; did you mean 'double'?
   33 |    　double ans = 0;
      |    ^~~~~~~~
      |    double
a.cc:43:9: error: 'ans' was not declared in this scope; did you mean 'abs'?
   43 |         ans += ((long double)1.0 / eq);
      |         ^~~
      |         abs
a.cc:46:13: error: 'ans' was not declared in this scope; did you mean 'abs'?
   46 |     cout << ans << endl;
      |             ^~~
      |             abs
Language: C++

#include <iostream>
using namespace std;
int main(){
    int N,K;
    cin >> N >> K;

    double total_rate = 0;
    for (int i = 0; i < N; i++){
        int score = i+1;
        double rate = 1;
        bool flag = true;
        while (flag){
            score = score*2;
            rate = rate/2;
            if (score >= K){
                flag = false;
            }
        }
        total_rate += rate;
    }
    printf("%.10f\n",total_rate/N);
    return 0;

Compiler output:
a.cc: In function 'int main()':
a.cc:22:14: error: expected '}' at end of input
   22 |     return 0;
      |              ^
a.cc:3:11: note: to match this '{'
    3 | int main(){
      |           ^