criyle/codenet-compile-errors huggingface dataset:
Language: Java

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main{
  public static void main(){
    String str;
      BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
       try {
            str = reader.readLine();
            reader.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
      String[] astr = str.split(" ");
      long n = Long.parseLong(astr[0]);
      long k = Long.parseLong(astr[1]);
      double result = 0;
      for(int i = 1; i <= n; i++){
          long p = 0, a = i;	
          while(a < k){
              a = a * 2;
              p++;
          }
          double tmp = 0.5;
          for(long j = 1; j < p; j++){
              tmp = tmp * 0.5 ;
          }
          result = result + tmp;
      }
      result = result / (double)3.0;
      System.out.print(result);
  }
}


Compiler output:
Main.java:15: error: variable str might not have been initialized
      String[] astr = str.split(" ");
                      ^
1 error
Language: Java

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main{
  public static void main(){
      BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
       try {
            String str = reader.readLine();
            reader.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
      String[] astr = str.split(" ");
      long n = Long.parseLong(astr[0]);
      long k = Long.parseLong(astr[1]);
      double result = 0;
      for(int i = 1; i <= n; i++){
          long p = 0, a = i;	
          while(a < k){
              a = a * 2;
              p++;
          }
          double tmp = 0.5;
          for(long j = 1; j < p; j++){
              tmp = tmp * 0.5 ;
          }
          result = result + tmp;
      }
      result = result / (double)3.0;
      System.out.print(result);
  }
}


Compiler output:
Main.java:14: error: cannot find symbol
      String[] astr = str.split(" ");
                      ^
  symbol:   variable str
  location: class Main
1 error
Language: Java

import java.util.Scanner;
public class Main{
  public static void main(){
      Scanner scan = new Scanner(System.in);
      String str = scan.next();
      String[] astr = str.split(" ");
      long n = Long.parseLong(astr[0]);
      long k = Long.parseLong(astr[1]);
      double result = 0;
      for(int i = 1; i <= n; i++){
          long p = 0; a = i;	
          while(a < k){
              a = a * 2;
              p++;
          }
          double tmp = 0.5;
          for(long j = 1; j < p; j++){
              tmp = tmp * 0.5 ;
          }
          result = result + tmp;
      }
      result = result / (double)3.0;
      System.out.print(result);
  }
}


Compiler output:
Main.java:11: error: cannot find symbol
          long p = 0; a = i;	
                      ^
  symbol:   variable a
  location: class Main
Main.java:12: error: cannot find symbol
          while(a < k){
                ^
  symbol:   variable a
  location: class Main
Main.java:13: error: cannot find symbol
              a = a * 2;
              ^
  symbol:   variable a
  location: class Main
Main.java:13: error: cannot find symbol
              a = a * 2;
                  ^
  symbol:   variable a
  location: class Main
4 errors
Language: Java

import java.util.Scanner;
public class Main{
  public static void main(){
    　Scanner scan = new Scanner(System.in);
   	　String str = scan.next();
      String[] astr = str.split(" ");
      long n = Long.parseLong(astr[0]);
      long k = Long.parseLong(astr[1]);
      double result = 0;
      for(int i = 1; i <= n; i++){
          long p = 0, a = n;	
          while(a < k){
              a = a * 2;
              p++;
          }
          double tmp = 0.5;
          for(long j = 1; j < p; j++){
              tmp = tmp * 0.5 ;
          }
          result = result + tmp;
      }
      result = result / (double)3.0;
      System.out.print(result);
  }
}


Compiler output:
Main.java:4: error: illegal character: '\u3000'
    ?Scanner scan = new Scanner(System.in);
    ^
Main.java:5: error: illegal character: '\u3000'
   	?String str = scan.next();
   	^
2 errors
Language: Java

import java.util.Scanner;
public class Main{
  public static void main(){
    　Scanner scan = new Scanner(System.in);
   	　String str1 = scan.next();
      String str2 = scan.next();
      long n = Long.parseLong(str1);
      long k = Long.parseLong(str2);
      double result = 0;
      for(int i = 1; i <= n; i++){
          long p = 0, a = n;	
          while(a < k){
              a = a * 2;
              p++;
          }
          double tmp = 0.5;
          for(long j = 1; j < p; j++){
              tmp = tmp * 0.5 ;
          }
          result = result + tmp;
      }
      result = result / (double)3.0;
      System.out.print(result);
  }
}


Compiler output:
Main.java:4: error: illegal character: '\u3000'
    ?Scanner scan = new Scanner(System.in);
    ^
Main.java:5: error: illegal character: '\u3000'
   	?String str1 = scan.next();
   	^
2 errors
Language: Java

import java.util.Scanner;
public class Main{
  public static void main(){
      Scanner scan = new Scanner(System.in);
      String str = scan.nextLine();
      String[] astr = str.split(" ",-1);
      scan.close();
      long n = (long)astr[0];
      long k = (long)astr[1];
      double result = 0;
      for(int i = 1; i <= 6; i++){
          long p = 0, a = n;	
          while(a < k){
              a = a * 2;
              p++;
          }
          double tmp = 0.5;
          for(long j = 1; j < p; j++){
              tmp = tmp * 0.5 ;
          }
          result = result + tmp;
      }
      result = result / (double)3.0;
      System.out.print(result);
  }
}


Compiler output:
Main.java:8: error: incompatible types: String cannot be converted to long
      long n = (long)astr[0];
                         ^
Main.java:9: error: incompatible types: String cannot be converted to long
      long k = (long)astr[1];
                         ^
2 errors
Language: Java

import java.util.Scanner;
public class Main{
  public static void main(){
      Scanner scan = new Scanner(System.in);
      String str = scan.nextLine();
      String[] astr = str.split(" ",-1);
      scan.close();
      long n = astr[0];
      long k = astr[1];
      double result = 0;
      for(int i = 1; i <= 6; i++){
          long p = 0, a = n;	
          while(a < k){
              a = a * 2;
              p++;
          }
          double tmp = 0.5;
          for(long j = 1; j < p; j++){
              tmp = tmp * 0.5 ;
          }
          result = result + tmp;
      }
      result = result / (double)3.0;
      System.out.print(result);
  }
}


Compiler output:
Main.java:8: error: incompatible types: String cannot be converted to long
      long n = astr[0];
                   ^
Main.java:9: error: incompatible types: String cannot be converted to long
      long k = astr[1];
                   ^
2 errors
Language: Java

import java.util.Scanner;
public class Main{
  public static void main(){
      Scanner scan = new Scanner(System.in);
      String str = scan.nextLine();
      String[] astr = str.split(" ",-1);
      scan.close();
      long n = astr[0];
      long k = astr[1];
      double result = 0;
      for(int i = 1; i <= 6; i++){
          long p = 0, a = n;	
          while(a < k){
              a = a * 2
              p++;
          }
          double tmp = 0.5;
          for(long j = 1; j < p; j++){
              tmp = tmp * 0.5 ;
          }
          result = result + tmp
      }
      result = result / (double)3.0;
      System.out.print(result);
  }
}


Compiler output:
Main.java:14: error: ';' expected
              a = a * 2
                       ^
Main.java:21: error: ';' expected
          result = result + tmp
                               ^
2 errors
Language: Java

import java.util.Scanner;
public class Main{
  public static void main(){
      Scanner scan = new Scanner(System.in);
      String str = scan.nextLine();
      String[] astr = str.split(" ",-1)
      scan.close();
      long n = astr[0];
      long k = astr[1];
      double result = 0;
      for(int i = 1; i <= 6; i++){
          long p = 0, a = n;	
          while(a < k){
              a = a * 2
              p++;
          }
          double tmp = 0.5;
          for(long j = 1; j < p; j++){
              tmp = tmp * 0.5 ;
          }
          result = result + tmp
      }
      result = result / (double)3.0;
      System.out.print(result);
  }
}


Compiler output:
Main.java:6: error: ';' expected
      String[] astr = str.split(" ",-1)
                                       ^
Main.java:14: error: ';' expected
              a = a * 2
                       ^
Main.java:21: error: ';' expected
          result = result + tmp
                               ^
3 errors
Language: Java

import java.util.Scanner;
public class Main(){
  public static void main(){
      Scanner scan = new Scanner(System.in);
      String str = scan.nextLine();
      String[] astr = str.split(" ",-1)
      scan.close();
      long n = astr[0];
      long k = astr[1];
      double result = 0;
      for(int i = 1; i <= 6; i++){
          long p = 0, a = n;	
          while(a < k){
              a = a * 2
              p++;
          }
          double tmp = 0.5;
          for(long j = 1; j < p; j++){
              tmp = tmp * 0.5 ;
          }
          result = result + tmp
      }
      result = result / (double)3.0;
      System.out.print(result);
  }
}

Compiler output:
Main.java:2: error: '{' expected
public class Main(){
                 ^
Main.java:6: error: ';' expected
      String[] astr = str.split(" ",-1)
                                       ^
Main.java:14: error: ';' expected
              a = a * 2
                       ^
Main.java:21: error: ';' expected
          result = result + tmp
                               ^
4 errors
Language: Java

import java.util.Scanner;

static void main(){
	Scanner scan = new Scanner(System.in);
  	String str = scan.nextLine();
    String[] astr = str.split(" ",-1)
    scan.close();
  	long n = astr[0];
  	long k = astr[1];
  	double result = 0;
  	for(int i = 1; i <= 6; i++){
    	long p = 0, a = n;	
      	while(a < k){
        	a = a * 2
            p++;
        }
      	double tmp = 0.5;
      	for(long j = 1; j < p; j++){
        	tmp = tmp * 0.5 ;
        }
      	result = result + tmp
    }
  	result = result / (double)3.0;
  	System.out.print(result);
}

Compiler output:
Main.java:3: error: unnamed classes are a preview feature and are disabled by default.
static void main(){
       ^
  (use --enable-preview to enable unnamed classes)
Main.java:6: error: ';' expected
    String[] astr = str.split(" ",-1)
                                     ^
Main.java:14: error: ';' expected
        	a = a * 2
        	         ^
Main.java:21: error: ';' expected
      	result = result + tmp
      	                     ^
4 errors
Language: C++

int main() {
    int n, k;
    scanf("%d%d", &n, &k);
    double ans = 0.0;
    rp(i, 1, n+1){
        double p = 1;
        int f = i;
        while(f < k){
            p /= 2;
            f *= 2;
        }
        ans += p;
    }
    ans /= n;
    cout << fixed << setprecision(12) << ans << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:3:5: error: 'scanf' was not declared in this scope
    3 |     scanf("%d%d", &n, &k);
      |     ^~~~~
a.cc:5:8: error: 'i' was not declared in this scope
    5 |     rp(i, 1, n+1){
      |        ^
a.cc:5:5: error: 'rp' was not declared in this scope
    5 |     rp(i, 1, n+1){
      |     ^~
a.cc:15:5: error: 'cout' was not declared in this scope
   15 |     cout << fixed << setprecision(12) << ans << endl;
      |     ^~~~
a.cc:15:13: error: 'fixed' was not declared in this scope
   15 |     cout << fixed << setprecision(12) << ans << endl;
      |             ^~~~~
a.cc:15:22: error: 'setprecision' was not declared in this scope
   15 |     cout << fixed << setprecision(12) << ans << endl;
      |                      ^~~~~~~~~~~~
a.cc:15:49: error: 'endl' was not declared in this scope
   15 |     cout << fixed << setprecision(12) << ans << endl;
      |                                                 ^~~~
Language: C++

#pragma gcc optimize("Ofast")
#include <bits/stdc++.h>

using namespace std;
using ll = long long;

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(V) (V).begin(),(V).end()
#define SORT(V) sort(ALL(V)) //小さい方からソート
#define REV(V) reverse(ALL(V)) //リバース
#define RSORT(V) SORT(V);REV(V) //大きい方からソート
#define NPN(V) next_permutation(ALL(V)) //順列
#define pb(n) push_back(n)
#define endl '\n'
#define Endl '\n'
#define DUMP(x)  cout << #x << " = " << (x) << endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define yes(n) cout << ((n) ? "yes" : "no"  ) << endl
#define Yay(n) cout << ((n) ? "Yay!": ":(") << endl
#define RAPID cin.tie(0);ios::sync_with_stdio(false)
#define VSUM(V) accumulate(ALL(V), 0)
#define MID(a,b,c) (a) < (b) && (b) < (c)
#define MIDe(a,b,c) (a) <= (b) && (b) <= (c)
#define IN(n) cin >> n
#define IN2(a,b) cin >> a >> b
#define IN3(a,b,c) cin >> a >> b >> c 
#define IN4(a,b,c,d) cin >> a >> b >> c >> d
#define VIN(V) for(int i = 0; i < (V).size(); i++) {cin >> (V).at(i);}
#define OUT(n) cout << n << endl
#define VOUT(V) REP(i, (V).size()) {cout << (V)[i] << endl;}
#define VOUT2(V) REP(i, (V).size()) {cout << (V)[i] << " ";} cout<<endl;

// 型マクロ定義
#define int long long
#define P pair<ll,ll>
#define Vi vector<ll>
#define VVi vector<vector<ll>>
#define Vd vector<double>
#define Vb vector<bool>
#define Vs vector<string>
#define Vc vector<char>
#define M map<ll,ll>
#define S set<ll>
#define PQ priority_queue<ll>
#define PQG priority_queue<ll,V,greater<ll>
//

const int MOD = 1000000007;
const int INF = 1061109567;
const double EPS = 1e-10;
const double PI  = acos(-1.0);

int gcd(int a,int b){return b != 0 ? gcd(b, a % b) : a;} //最大公約数
int lcm(int a, int b){return a * b / gcd(a, b);}
string toStrUp(string str){char diff = 'A'-'a';REP(i,str.size()) str[i] += diff;return str;}
string gCh(string str, int key){return str.substr(key,1);}

signed main() {
  RAPID;
  // デフォルト変数定義
  double n=0,m=0,a=0,b=0,c=0,d=0,x=0,y=0,z=0;
  string s="",t="";
  //

  // ここから
  IN2(n,x);
  double sum = 0;
  FOR(i,1,n+1){
    double tmp = 1.0 / n;
    int now = i;
    while(now < x){
      now *= 2;
      tmp /= 2;
    }
    sum += tmp;
  }
  FIX;
  OUT(sum);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:79:3: error: 'FIX' was not declared in this scope
   79 |   FIX;
      |   ^~~
Language: C++

#include<iostream>
#include<algorithm>
using namespace std;
int fun(int a,int k){
	for(int i=1;;i++){
		a*=2;
		if(a>=k)return i;
	}
}
int n,k;
int main(){
	cin>>n>>k;
	double sum=0;
	for(int i=1;i<=n;i++){
		int tmp=fun(i,k);
		if(i<k)sum+=(1.0/n*pow(1.0/2,tmp));
		else sum+=1.0/n;
	}
	printf("%.12f",sum);
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:36: error: 'pow' was not declared in this scope
   16 |                 if(i<k)sum+=(1.0/n*pow(1.0/2,tmp));
      |                                    ^~~
Language: C++

import numpy as np

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

nx = np.arange(1, n+1)


ans = 0
ed = n
coin = 0

while (ed > 0):
    ct = 0
    for i in range(ed-1, -1, -1):
        if (nx[i] >= k):
            ct += 1
            ed = i
        else:
            break
    ans += ct*(1/2**(coin))

    print(nx)
    nx *= 2
    coin += 1

print(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>
using namespace std;

int main(){
    int n,k;
    cin>>n>>k;
    double dist=0.0;
    double su=0;
    for(int i=1; i<=n; i++){
        int co=i;
        dist=1.0/double(n);
        while(co<k){
            dist*=double(1.0/2.0);
            co*=2;
        }
        su+=double(dist);
    }
    cout << std::fixed;
    cout << std::setprecision(15)<<su<<endl;
    cout<<su<<endl;

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

#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <map>
#include <bitset>
#include <stack>
#include <queue>
#include <list>
#include <iomanip>
#include <numeric>

using namespace std;
typedef long long ll;
ll mod = 1000000007;
const int INF = 1001001001;

template<class Type>
Type modpow(Type a, Type n, Type mod)
{
	Type res = 1;
	while (0 < n) {
		if (n & 1) {
			res = res * a % mod;
		}
		a = a * a % mod;
		n >>= 1;
	}
	return res;
}

template<class Type>
Type gcd(Type x, Type y)
{
	Type r;
	if (x < y) swap(x, y);

	while (0 < y) {
		r = x % y;
		x = y;
		y = r;
	}
	return x;
}

template<class Type>
Type lcm(Type x, Type y)
{
	return x * y / gcd(x, y);
}

template<class Type>
bool is_prime(Type x)
{
	if (x == 2) return true;
	if (x < 2 || x % 2 == 0) return false;

	for (Type i = 3; i <= sqrt(x); i += 2) {
		if (x % i == 0) return false;
	}
	return true;
}

template<class Type>
vector<bool> eratos(Type n)
{
	vector<bool> isPrime(n + 1, true);
	isPrime[0] = isPrime[1] = false;
	for (Type i = 2; i <= n; i++) {
		if (isPrime[i]) {
			Type j = i + i;
			while (j <= n) {
				isPrime[j] = false;
				j = j + i;
			}
		}
	}
	return isPrime;
}

bool binary_search_judge(vector<int> a, int index, int key)
{
	if (key <= a[index]) return true;
	else return false;
}

int binary_search(vector<int> a, int key)
{
	int ng = -1;
	int ok = a.size();
	while (1 < abs(ng - ok)) {
		int mid = (ng + ok) / 2;
		if (binary_search_judge(a, mid, key)) ok = mid;
		else ng = mid;
	}
	return a[ok] == key;
}

int main()
{
	double n, k;
	cin >> n >> k;
	double p = 0;
	for (int i = 1; i <= n; i++) {
		int tmp = i;
		int count = 0;
		while (tmp < k) {
			tmp *= 2;
			count++;
		}
		p += (1.0 / n) * (pow((1.0 / 2.0), count));
	}
	cout << fixed << setprecision(12) << p << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:111:35: error: 'pow' was not declared in this scope
  111 |                 p += (1.0 / n) * (pow((1.0 / 2.0), count));
      |                                   ^~~
Language: C++

#include <bits/stdc++.h>
#include <algorithm>
#define rep(i,n) for(int i=0;i<(n);++i)
#define all(x) (x).begin(), (x).end()
#define PB(x) push_back(x)
#define MP(x,y) make_pair(x,y)
#define _GLIBCXX_DEBUG
using namespace std;
using P = pair<int,int>;
typedef long long ll;


int main() {

    int n,k;
    cin>>n>>k;

    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);

 return 0;
}

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

#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <utility>
#include <map>

#include <stdio.h>

#define rep(i, n) for (int i = 0; i < (n); i++)
#define irep(i, k, n) for (int i = (k); i < (n); i++)
#define rrep(i, k, n) for (int i = (k); i >= (n); i++)
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define vec vector

typedef long long ll;

const ll inf = 1LL << 60;
const int mod = 1e9 + 7;

using namespace std;

/* Input variables. */
int n, k;

/* Solve! */
void solve() {
  double sum = 0;
  irep(i, 1, n + 1) {
    double p = 1.0 / n;
    int v = i;
    while (v < k) v *= 2, p /= 2;
    sum += p;
  }
  printf("%.20f", sum);
  cout << endl;
}

int main() {
  /* Input handling. */
  cin >> n >> k;

  solve();
  return 0;
}

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

#include<bits/stdc++.h>
#define I int
#define S(a) scanf("%d",&a)
#define S2(a,b) scanf("%d%d",&a,&b)
#define P(a) printf("%d\n",a)
#define PL(a) printf("%lld\n",a)
#define PT(t) printf("Case %d: ",t)
#define PB(a) push_back(a)
#define SET(a) memset(a,0,sizeof a)
#define SETR(a) memset(a,-1,sizeof a)
#define ll long long 
using namespace std;
#define mx 500004
#define md 1000000007ll
typedef pair<int, int >P;
typedef vector<ll>V;

////////define value/////
template <class T> inline T BM(T p, T e, T M)
{
    ll ret = 1;
    for(; e > 0; e >>= 1)
    {
        if(e & 1) ret = (ret * p) % M;
        p = (p * p) % M;
    }
    return (T)ret;
}
template <class T> inline T gcd(T a, T b)
{
    if(b == 0)return a;
    return gcd(b, a % b);
}
template <class T> inline T mdINV(T a, T M)
{
    return BM(a, M - 2, M);
}
template <class T> inline T PW(T p, T e)
{
    ll ret = 1;
    for(; e > 0; e >>= 1)
    {
        if(e & 1) ret = (ret * p);
        p = (p * p);
    }
    return (T)ret;
}
 
 
template <class T>bool ISLEFT(T a, T b, T c)
{
    if(((a.xx - b.xx) * (b.yy - c.yy) - (b.xx - c.xx) * (a.yy - b.yy)) < 0.0)return 1;  //Uporer dike //A,b,c, x okkher ordera sorted
    else return 0;
}

int main(){
int n,m;
    cin>>n>>m;
    double res =0;
    for(int i=1;i<=n;i++){

        int cnt =0;
        int sum=0;
        for(int j =i;;j*=2){
            sum+=j;
            cnt++;
            if(sum>m)break;
            }
        double am = 1;
        for(int j=1;j<=cnt;j++)am*=.5;
        double sum = (am)/(double)n;
        res+=sum;
    }
    printf("%.10lf\n",res);
   //cout<<res<<endl;

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:71:16: error: conflicting declaration 'double sum'
   71 |         double sum = (am)/(double)n;
      |                ^~~
a.cc:63:13: note: previous declaration as 'int sum'
   63 |         int sum=0;
      |             ^~~
Language: Java

import java.util.*;

 class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long N = sc.nextLong();
        long K = sc.nextLong();
        double p=0;
        
        for(int i=1;i<=N;i++) {
        	double k = 1.0/N;
        	for(int j=i;j<K;j=j*2){
        		k=k/2;
        	}
        	p=p+k;
        }
        System.out.println(p);
    }

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

uses crt, math;
var
        i,n,k,tmp,tmp2:longint;
        kq:real;
begin
        clrscr;
        readln(n, k);
        kq:=0;
        for i:=1 to n do begin
                tmp:=i;
                tmp2:=0;
                while tmp<k do begin
                        tmp:=tmp*2;
                        inc(tmp2);
                end;
                kq:=kq+(1/n)*power(0.5, tmp2);
        end;
        writeln(kq:0:20);
        readln;
end.


Compiler output:
a.cc:1:1: error: 'uses' does not name a type
    1 | uses crt, math;
      | ^~~~
a.cc:2:1: error: 'var' does not name a type
    2 | var
      | ^~~
a.cc:4:11: error: found ':' in nested-name-specifier, expected '::'
    4 |         kq:real;
      |           ^
      |           ::
a.cc:4:9: error: 'kq' does not name a type
    4 |         kq:real;
      |         ^~
a.cc:5:1: error: 'begin' does not name a type
    5 | begin
      | ^~~~~
a.cc:7:15: error: expected constructor, destructor, or type conversion before '(' token
    7 |         readln(n, k);
      |               ^
a.cc:8:9: error: 'kq' does not name a type
    8 |         kq:=0;
      |         ^~
a.cc:9:9: error: expected unqualified-id before 'for'
    9 |         for i:=1 to n do begin
      |         ^~~
a.cc:11:17: error: 'tmp2' does not name a type
   11 |                 tmp2:=0;
      |                 ^~~~
a.cc:12:17: error: expected unqualified-id before 'while'
   12 |                 while tmp<k do begin
      |                 ^~~~~
a.cc:14:28: error: expected constructor, destructor, or type conversion before '(' token
   14 |                         inc(tmp2);
      |                            ^
a.cc:15:17: error: 'end' does not name a type
   15 |                 end;
      |                 ^~~
a.cc:16:17: error: 'kq' does not name a type
   16 |                 kq:=kq+(1/n)*power(0.5, tmp2);
      |                 ^~
a.cc:17:9: error: 'end' does not name a type
   17 |         end;
      |         ^~~
a.cc:18:16: error: expected constructor, destructor, or type conversion before '(' token
   18 |         writeln(kq:0:20);
      |                ^
a.cc:19:9: error: 'readln' does not name a type
   19 |         readln;
      |         ^~~~~~
a.cc:20:1: error: 'end' does not name a type
   20 | end.
      | ^~~
Language: C++

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

int main(){
  int n, k;
  cin >> n >> k;
  int ma;
  double p = 0;
  if(k > n){
    ma = n;
  }else{
    ma = k - 1;
    p += (n - k + 1) / n;
  }
  for(int i = 1; i < ma + 1; i++){
    double p_tmp = (1 / double(n));
    for(int j = 1; j < ma - i + 2; j++){
      p_tmp *= 1 / douoble(2);
    }
    p += p_tmp;
  }
  cout << setprecision(11) << p;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:20: error: 'douoble' was not declared in this scope; did you mean 'double'?
   18 |       p_tmp *= 1 / douoble(2);
      |                    ^~~~~~~
      |                    double
Language: C

#include <bits/stdc++.h>
#include<iomanip>
 
using namespace std;
 
int main(){
    long n,k;cin>>n>>k;
    long num,l,val;
    int count=0;
    
    
    double ans=0.0,k1;
    for(long i=1;i<=n;i++)
    {
        
    val=i;
    if(val<k){
    while(val<=k)
    {
        count++;
        val*=2;
    }
    
    k1=n*(pow(2,count));
    count=0;}
    else
    k1=n*1.0;
    
    ans+=(1/k1);
    }
    cout<<setprecision(12)<<(ans);
    
    

}

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

#include<iostream>
#include<cmath>
using namespace std;
int main(){
float p=0;
int N,K,i,j;
cin>>N>>K;
for(j=1;j<=N;j++)
{i=0;
if(j<k)
for(i=1;(pow(2,i)+j)<K;i++);
p=p+(1/N)*pow((1/2),i);
}
cout<<p; 
return 0;}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:6: error: 'k' was not declared in this scope
   10 | if(j<k)
      |      ^
Language: C++

#include<iostream>
using namespace std;
int main(){
float p=0;
int N,K,i,j;
cin>>N>>K;
for(j=1;j<=N;j++)
{i=0;
if(j<k)
for(i=1;(pow(2,i)+j)<K;i++);
p=p+(1/N)*pow((1/2),i);
}
cout<<p; 
return 0;}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:6: error: 'k' was not declared in this scope
    9 | if(j<k)
      |      ^
a.cc:10:10: error: 'pow' was not declared in this scope
   10 | for(i=1;(pow(2,i)+j)<K;i++);
      |          ^~~
a.cc:11:11: error: 'pow' was not declared in this scope
   11 | p=p+(1/N)*pow((1/2),i);
      |           ^~~
Language: C++

#include<iostream>
int main(){
float p=0;
int N,K,i,j;
cin>>N>>K;
for(j=1;j<=N;j++)
{i=0;
if(j<k)
for(i=1;(pow(2,i)+j)<K;i++);
p=p+(1/N)*pow((1/2),i);
}
cout<<p; 
return 0;}

Compiler output:
a.cc: In function 'int main()':
a.cc:5:1: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
    5 | cin>>N>>K;
      | ^~~
      | std::cin
In file included from a.cc:1:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
a.cc:8:6: error: 'k' was not declared in this scope
    8 | if(j<k)
      |      ^
a.cc:9:10: error: 'pow' was not declared in this scope
    9 | for(i=1;(pow(2,i)+j)<K;i++);
      |          ^~~
a.cc:10:11: error: 'pow' was not declared in this scope
   10 | p=p+(1/N)*pow((1/2),i);
      |           ^~~
a.cc:12:1: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   12 | cout<<p;
      | ^~~~
      | std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
Language: C

include<stdio.h>
int main()
{
int n,c=0,k,i,a[10000],j,p;
long double f=0;
scanf("%d%d",&n,&k);
for(i=1;i<=n;i++)
{ 
p=i;
for(j=i;p<k;)
{
p=p*2;
c++;}
f=f+((1/n)*(pow(0.5,c)));
}
printf("%ld",f);


return 0;
}

Compiler output:
main.c:1:8: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token
    1 | include<stdio.h>
      |        ^
Language: C

#include <bits/stdc++.h>
 
using namespace std;
 
int main(){
    int n,k;cin>>n>>k;
    int num;
    float l1;
    int l;
    double ans=0.0;
    
    for(int i=1;i<=n;i++){
        num=k-i;
        l=l1=log2(num);
        
        ans+=((1.0/(n*((pow(2,l)+1))))); 
        
    }
    cout<<setprecision(12)<<(ans);
    
    

}

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

/****************************************************
*   Template for coding contests                    *
*   Author    :    Sanjeev Sharma                   *
*   Email     :    thedevelopersanjeev@gmail.com    *
*****************************************************/
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")

#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>

using namespace std;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int n, k;
    cin >>n >>k;
    double ans = 0;
    for(int i = 1; i <= n; i++){
        double temp = 1.0 / n;
        int now = i;
        while(now < b){
            now *= 2;
            temp /= 2;
        }
        ans += temp;
    }
    cout <<fixed <<setprecision(12) <<ans;
    return 0;
}


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

/****************************************************
*   Template for coding contests                    *
*   Author    :    Sanjeev Sharma                   *
*   Email     :    thedevelopersanjeev@gmail.com    *
*****************************************************/
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")

#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>

using namespace std;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    long long n, k;
    cin >>n >>k;
    long long ans = -1;
    vector<long long> deno;
    for(long long i = 1; i <= n; i++){
        long long sc = i;
        long long turn = 0;
        while(sc < k){
            sc = 2 * sc;
            turn++;
        }
        long long val = (1 << turn);
        deno.push_back(val);
        ans = max(ans, val);
    }
    long long num = 0;
    for(long long i = 0; i < num.size(); i++)
        num += (ans / deno[i]);
    cout <<fixed <<setprecision(10) <<(num * 1.0 / (ans * n));
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:35:34: error: request for member 'size' in 'num', which is of non-class type 'long long int'
   35 |     for(long long i = 0; i < num.size(); i++)
      |                                  ^~~~
Language: C

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

int main(void) {

	double p[10001];
	int count[10001];
	int i;
	int n, k;
	double posi=0;
	int h;
	
	h=scanf("%d %d", &n, &k);
	for (i = 1; i <= n; i++) {
		p[i] = i;
		count[i] = 0;
		while (p[i]<k) {
			p[i] = p[i] * 2;
			count[i]++;
		}
		posi = posi + pow(0.5000, count[i])/n;
	}
	printf("%12lf", posi);
	return 0;


Compiler output:
main.c: In function 'main':
main.c:25:9: error: expected declaration or statement at end of input
   25 |         return 0;
      |         ^~~~~~
Language: C

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

int main(void) {

	double p[10001];
	int count[10001];
	int i;
	int n, k;
	double posi=0;
	int h;
	
	h=scanf("%d %d", &n, &k);
	for (i = 1; i <= n; i++) {
		p[i] = i;
		count[i] = 0;
		while (p[i]<k) {
			p[i] = p[i] * 2;
			count[i]++;
		}
		posi = posi + pow(0.5000, count[i])/n;
	}
	printf("%lf", posi);
	return 0;


Compiler output:
main.c: In function 'main':
main.c:25:9: error: expected declaration or statement at end of input
   25 |         return 0;
      |         ^~~~~~
Language: C++

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

Compiler output:
a.cc: In function 'int main()':
a.cc:5:3: error: 'scanf' was not declared in this scope
    5 |   scanf("%d%d", &a, &b);
      |   ^~~~~
a.cc:16:3: error: 'printf' was not declared in this scope
   16 |   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 | using namespace std;
Language: C++

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

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

Compiler output:
a.cc:2:7: error: expected nested-name-specifier before 'namespase'
    2 | using namespase std;
      |       ^~~~~~~~~
Language: C

#include <stdio.h>
#include <math.h>
int main(void) {
	int N,K,tmp,i;
	double ans;
	scanf("%lld %lld",&N,&K);
	int count[N]={};
	for(i=0;i<N;i++){
		tmp=i+1;
		while(1){
			if(tmp>=K){
				break;
			}else{
				tmp=tmp*2;
				count[i]++;
			}
		}
	}
	for(i=0;i<N;i++){
		ans=ans+(1/(double)N)*pow(0.5,count[i]);
	}
	printf("%.12f",ans);
	
	return 0;
}

Compiler output:
/usr/bin/ld: /tmp/cc9ZpxoM.o: in function `main':
main.c:(.text+0x12c): undefined reference to `pow'
collect2: error: ld returned 1 exit status
Language: C++

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

int main() {
  double n,k,ans,x;
  cin >> n >> k;
  ans+=(n-k+1.0)/n;
  rep(i,k-1){
  	double tmp=1.0/n;
  	x=i+1;
  	while(x<k){
  		x*=2;
  		tmp*=0.5;
  	}
  	ans+=tmp;
  }
  cout << setprecision(15) << ans << endl;

Compiler output:
a.cc: In function 'int main()':
a.cc:20:43: error: expected '}' at end of input
   20 |   cout << setprecision(15) << ans << endl;
      |                                           ^
a.cc:7:12: note: to match this '{'
    7 | int main() {
      |            ^
Language: C++

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

int main() {
  double n,k,ans,x;
  cin >> n >> k;
  ans+=(n-k+1.0)/n;
  rep(i,k-1){
  	double tmp=1.0/b;
  	x=i+1;
  	while(x<k){
  		x*=2;
  		tmp*=0.5;
  	}
  	ans+=tmp;
  }
  cout << setprecision(15) << ans << endl;

Compiler output:
a.cc: In function 'int main()':
a.cc:12:24: error: 'b' was not declared in this scope
   12 |         double tmp=1.0/b;
      |                        ^
a.cc:20:43: error: expected '}' at end of input
   20 |   cout << setprecision(15) << ans << endl;
      |                                           ^
a.cc:7:12: note: to match this '{'
    7 | int main() {
      |            ^
Language: C++

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

int main() {
  double n,k,ans,x;
  cin >> n >> k;
  ans+=(n-k+1.0)/n;
  rep(i,k-1){
  	double tmp=1.0/b;
  	x=i+1;
  	while(x<k){
  		x*=2;
  		tmp*=0.5;
  	}
  	ans+=tmp;
  }
  cout << setprecision(10) << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:12:24: error: 'b' was not declared in this scope
   12 |         double tmp=1.0/b;
      |                        ^
Language: C++

#include <iostream>
#include <iomanip>

using namespace std;

int main()
{
	int N, K, temp;
	double ans = 0;
	cin >> N >> K;
	double test;
	double dice_per = (1.0 / (double)N);

	for (int i = 1; i <= N; i++) {
		if (i < K) {
			for (int j = 1; ; j++) {
				temp = i * (pow(2, j));

				if (K <= temp) {
					test = dice_per * pow(0.5, j);
					ans += test;
					break;
				}
			}
		}

		else if (i == K) {
			double temp = ((double)(N - i + 1) / double(N));
			ans += temp;
			break;
		}
	}

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

Compiler output:
a.cc: In function 'int main()':
a.cc:17:45: error: 'pow' was not declared in this scope
   17 |                                 temp = i * (pow(2, j));
      |                                             ^~~
Language: C++

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

long double f(ll n, ll a)
{

    ll c = 0;
    while (a < 10)
    {
        a *= 2;
        c++;
    }

    return (1.L / n) * pow(0.5, c);
}

int main()
{
    ll n, k;
    cin >> n >> k;
    long double r = 0;
    for (int i = 1; i < n + 1; i++)
    {
        r += f(n, i);
    }
    print(r);

    return 0;
}


Compiler output:
a.cc:7:17: error: expected ')' before 'n'
    7 | long double f(ll n, ll a)
      |              ~  ^~
      |                 )
a.cc:7:23: error: expected ')' before 'a'
    7 | long double f(ll n, ll a)
      |              ~        ^~
      |                       )
a.cc:7:25: error: expression list treated as compound expression in initializer [-fpermissive]
    7 | long double f(ll n, ll a)
      |                         ^
a.cc:8:1: error: expected ',' or ';' before '{' token
    8 | {
      | ^
a.cc: In function 'int main()':
a.cc:22:7: error: expected ';' before 'n'
   22 |     ll n, k;
      |       ^~
      |       ;
a.cc:23:12: error: 'n' was not declared in this scope; did you mean 'yn'?
   23 |     cin >> n >> k;
      |            ^
      |            yn
a.cc:23:17: error: 'k' was not declared in this scope
   23 |     cin >> n >> k;
      |                 ^
a.cc:27:15: error: 'f' cannot be used as a function
   27 |         r += f(n, i);
      |              ~^~~~~~
Language: C++

#include <bits/stdc++.h>

using namespace std;

int main(){
  long long n,k; cin >> n >> k;
  //i+1はサイコロの目
  long long ans=0;
  for(int i=0;i<n;i++){
    //j+1は表が出る回数
    long long score=i+1;
    long long a=1.0;
    for(int j=0;j<k;j++){
      score *=2;
      count++;
      a /=2.0;
      if(score>=k){
        break;
      }
    }
    ans+=a/n;
  }
  cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:12: error: no post-increment operator for type
   15 |       count++;
      |            ^~
Language: C++

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

int main()
{
	int N, K, temp;
	double ans = 0;
	cin >> N >> K;
	double test;
	double dice_per = (1.0 / (double)N);
	cout << "dice_per" << dice_per << endl;
	for (int i = 1; i <= N; i++) {
		if (i < K) {
			for (int j = 1; ; j++) {
				temp = i * (pow(2, j));

				if (K <= temp) {
					//cout << temp << endl << j << endl;
					cout << i << "j:" << j << endl;
					test = dice_per * pow(0.5, j);
					cout << fixed << "N:" << 1.0 / (double)N << endl;
					cout << setprecision(15) << "test:" << test << endl;
					ans += test;
					cout << setprecision(15) << ans << endl;
					break;
				}
			}
		}

		else if (i == K) {
			double temp = ((double)(N - i + 1) / double(N));
			cout << "temp" << temp << endl;
			ans += temp;
			break;
		}
	}

	cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:45: error: 'pow' was not declared in this scope
   16 |                                 temp = i * (pow(2, j));
      |                                             ^~~
Language: C++

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

int main(){
  int a,b; cin>>a>>b;
  double ans=0;
  for(int i=1;i<=a;i++){
    double x=1.0/a;
    int now=i;
    while(now<b){
      now*=2;
      tmp/=2;
    }
    ans+=tmp;
  }
  cout<<ans<<endl;
}

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

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

int main() {
  int n,k,j=0;
  cin >> n >> k ;
  float f=0,a,b;
  vector<float> a(n);
  for(int i=1;i<=n;i++){
    for(int l=1;k>i*pow(2,l);l++){
      if(k<=i*pow(2,l)){
        a.at(j)=l;
        j++;
      }
    }
  }

  for(int i=0;i<n;i++){
    f+=1/pow(2,a.at(i));
  }
  a=n;
  b=1/a*f;
  cout << fixed << b << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:17: error: conflicting declaration 'std::vector<float> a'
    8 |   vector<float> a(n);
      |                 ^
a.cc:7:13: note: previous declaration as 'float a'
    7 |   float f=0,a,b;
      |             ^
a.cc:12:11: error: request for member 'at' in 'a', which is of non-class type 'float'
   12 |         a.at(j)=l;
      |           ^~
a.cc:19:18: error: request for member 'at' in 'a', which is of non-class type 'float'
   19 |     f+=1/pow(2,a.at(i));
      |                  ^~
Language: C++

/*Function Template*/
#include<bits/stdc++.h>
using namespace std;
const int mod = 1000000007;
#define rep(i, n) for(long long int i = 0; i < (n); i++)


int Len(int n) {
  int s=0;
  while(n!=0) s++, n/=10;
  return s;
}


int Sint(int n) {
  int m=0,s=0,a=n;
  while(a!=0) s++, a/=10;
  for(int i=s-1;i>=0;i--) m+=n/((int)pow(10,i))-(n/((int)pow(10,i+1)))*10;
  return m;
}


int Svec(vector<int> v){
  int n=0;
  for(int i=0;i<v.size();i++) n+=v[i];
  return n;
}


int GCD(int a,int b){
  int r,tmp;
/*自然数 a > b を確認・入替*/
  if(a<b){
    tmp=a,a=b,b=tmp;
  }
/*ユークリッドの互除法*/
  r=a%b;
  while(r!=0){
    a=b,b=r,r=a%b;
  }
  return b;
}


int LCM(int a,int b){
  int c=a,d=b,r,tmp;
/*自然数 a > b を確認・入替*/
  if(a<b){
    tmp=a,a=b,b=tmp;
  }
/*ユークリッドの互除法*/
  r=a%b;
  while(r!=0){
    a=b,b=r,r=a%b;
  }
  return c/b*d;
}


int Factorial(int n){
  int m=1;
  while(n>=1) m*=n,n--;
  return m;
}


/*↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓*/
int main() {
  double n,k,ans=0;
  cin>>n>>k;
  for(long long int=1;i<=n;i++){
    int cnt=0;
    while(i>=k){
      i*=2;
      cnt++;
    }
    ans+=(double)pow(0.5,cnt);
  }
  cout<<setprecision(10)<<ans*(1/n)<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:71:20: error: expected unqualified-id before '=' token
   71 |   for(long long int=1;i<=n;i++){
      |                    ^
a.cc:71:20: error: expected ';' before '=' token
   71 |   for(long long int=1;i<=n;i++){
      |                    ^
      |                    ;
a.cc:71:20: error: expected primary-expression before '=' token
a.cc:71:23: error: 'i' was not declared in this scope
   71 |   for(long long int=1;i<=n;i++){
      |                       ^
a.cc:71:27: error: expected ')' before ';' token
   71 |   for(long long int=1;i<=n;i++){
      |      ~                    ^
      |                           )
a.cc:71:28: error: 'i' was not declared in this scope
   71 |   for(long long int=1;i<=n;i++){
      |                            ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#define all(x) (x).begin(),(x).end()
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define REP(i, m, n) for(int i = m; i < n; i++)
#define INF INT_MAX
#define MOD 1000000007
#define fcout cout << fixed << setprecision(15)
 #define int long long
typedef long long ll;
typedef pair<int, int> P;
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);};
int mod(int a,int b){return (a+b-1)/b;};
int month[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
template<class T>inline bool chmax(T& a,T b){if(a < b){a=b;return true;}return false;};
template<class T>inline bool chmin(T& a,T b){if(a > b){a=b;return true;}return false;};



signed main() {
  cin.tie(0);
  cout.tie(0);
  ios::sync_with_stdio(false);

  int a, b;
  cin >> a >> b;
  double r = 0;
  REP(i, 1, a + 1) {
    double tmp = 1.0 / a;
    int now = i;
    while(now < b) {
      now *= 2;
      tmp /= 2;
    }
    ret += tmp;
  }
  fcout << ret << endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:37:5: error: 'ret' was not declared in this scope; did you mean 'rep'?
   37 |     ret += tmp;
      |     ^~~
      |     rep
a.cc:39:12: error: 'ret' was not declared in this scope; did you mean 'rep'?
   39 |   fcout << ret << endl;
      |            ^~~
      |            rep
Language: C++

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

int main()
{
    int i=0;

string b;
    string a[]={"0"};
    int c=0;
    int z=0;
    int m=0;

     cin.ignore(1);
   for(int v=0;v<=1001;v++){

    cin>>a[v];
b=a[v];

if(b.at(1)=='}'){
        m=size
    goto here;
}




   }
   here:
    cout <<"hi";

    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:22:11: error: cannot resolve overloaded function 'size' based on conversion to type 'int'
   22 |         m=size
      |           ^~~~
Language: C++

#include <iostream>

using namespace std;

int main(){
    double n,k;
    cin >> n >> k;
    double sum=0.0;
    //iの目が出たときk以上に達する確率の和
    for(int i=1;i<=n;i++){
        double s=i;
        double p=1;
        while(s<k){
            s*=2.0;
            p/=2.0;
        }
        sum+=p;
        cout << sum << endl;
    }
    //sumをnで割る
    sum/=n;
    std::cout<<std::fixed<<std::setprecision(10);
    cout << sum << endl;
    
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:22:33: error: 'setprecision' is not a member of 'std'
   22 |     std::cout<<std::fixed<<std::setprecision(10);
      |                                 ^~~~~~~~~~~~
a.cc:2:1: note: 'std::setprecision' is defined in header '<iomanip>'; this is probably fixable by adding '#include <iomanip>'
    1 | #include <iostream>
  +++ |+#include <iomanip>
    2 |
Language: C++

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

long double n, k;

int func(int a) {
	int flow = a;
	int res = 0;
	for (int i = 0; ; i++) {
		if (flow >= k) break;
		flow *= 2;
		res++;
	}
	return res;
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	cin >> n >> k;
	vector<long double> ans(n);
	int s = k / 2;
	for (int i = 1; i < n;i++) {
		ans[i] = long double(1/n) * pow(0.5, func(i + 1));
	}
	ans[0] = ans[1] * (0.5);
	long double sol = 0;
	rep(i, n) sol += ans[i];
	cout << sol << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:26:26: error: expected primary-expression before 'long'
   26 |                 ans[i] = long double(1/n) * pow(0.5, func(i + 1));
      |                          ^~~~
Language: C++

#include <bits/stdc++.h>
#define rep(i, a, b) for (int i = (a); i < (b); ++i)
#define ll long long int
#define INF 1LL << 62
#define MOD 1000000007
#define fir first
#define sec second
#define all(x) x.begin(), x.end()
using namespace std;

void Main() {
    int n, k;
    cin >> n >> k;
    double ans;
    rep(i, 1, n + 1) {
        int score = i;
        int multi = 0;
        while (score < k) {
            score *= 2;
            multi++;
        }
        ans += pow((double)1 / 2, multi) / n;
    }
    cout << ans << endl;
    return;
}

int main() {
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    // cout << fixed << setprecision(12) << endl;
    Main();
    return 0;


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