stablegradients/pie-gem5-bysrc huggingface dataset:
// Original C++ solution (slower):
#include <string>

#include <stdio.h>

#include <algorithm>

#include <iostream>

#include <vector>

#include <cmath>

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

using namespace std;

 

double expValue(int val){

    double ans = 0;

    for(int i = 0; i <= val; i++) ans += i;

    return ans / val;

}

 

int main()

{

    int n, k;

    cin >> n >> k;

    long double tot = 0;

    vector<double> table(200005);

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

        int a;

        cin >> a;

        table[i] = expValue(a);

    } 

    for(int i = 1; i <= k; i++) tot += table[i];

    long double max = tot;

    for(int i = 1; i + k <= n; i++){

        tot -= table[i];

        tot += table[i+k];

        if(max < tot) max = tot;

    }

    printf("%Lf", max);

}


// Optimized solution to the same problem (faster):
#include <bits/stdc++.h>

using namespace std;



// D - Dice in Line

int main() {

    int N, K;

    cin >> N >> K;



    long double p[N];

    int tmpP;

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

        cin >> tmpP;

        p[i] = ((tmpP + 1.0) / 2.0);

    }



    /*

    // debug

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

        cout << p[i] << endl;

    }

    */



    long double nowSum = 0, maxSum = 0;

    for (int i = 0; i < K; i++) {

        nowSum = nowSum + p[i];

    }   

    // cout << "nowSum:" << nowSum << endl; // debug

    maxSum = nowSum;

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

        nowSum = nowSum - p[i - K] + p[i];

        maxSum = max(nowSum, maxSum);

    }

    // cout << maxSum;

    printf("%Lf", maxSum);

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

#define INF 1LL<<62

#define inf 1000000007



int main() {

	ll n,k;

	cin>>n>>k;

	long double p[200010];

	for(ll i=0;i<n;i++){

		long double x;

		cin>>x;

		p[i]=x;

	}

	long double ch[200010]={};

	for(ll i=0;i<n;i++){

		long double now=(p[i]+1.0)/2;

		if(p[i]==1){

			now=1.0;

		}

		ch[i]=now;

		//printf("%.10Lf\n",now);

	}

	long double ans=0;

	for(ll i=0;i<k;i++){

		ans+=ch[i];

	}

	long double now=ans;

	for(ll i=0;i<n-k;i++){

	//printf("%.10Lf\n",now);		

		now-=ch[i];

		now+=ch[i+k];

		ans=max(now,ans);

	}

	printf("%.10Lf",ans);

	// your code goes here

	return 0;

}

// Optimized solution to the same problem (faster):
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

#define INF 1LL<<62

#define inf 1000000007



int main() {

	ll n,k;

	cin>>n>>k;

	long double ch[200010];

	for(ll i=0;i<n;i++){

		cin>>ch[i];

	}

	long double ans=0;

	for(ll i=0;i<k;i++){

		long double now=ch[i];

		now=(now+1)/2;

		ans+=now;

	}

	long double cnt=ans;

	for(ll i=k;i<n;i++){

		long double now1=ch[i];

		now1=(now1+1)/2;

		long double now2=ch[i-k];

		now2=(now2+1)/2;

		cnt+=now1-now2;

		ans=max(ans,cnt);

	}

	printf("%.10Lf",ans);

	// your code goes here

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

#define INF 1LL<<62

#define inf 1000000007



int main() {

	ll n,k;

	cin>>n>>k;

	long double p[200010];

	for(ll i=0;i<n;i++){

		long double x;

		cin>>x;

		p[i]=x;

	}

	long double ch[200010]={};

	for(ll i=0;i<n;i++){

		long double now=(p[i]+1.0)/2;

		if(p[i]==1){

			now=1.0;

		}

		ch[i]=now;

		//printf("%.10Lf\n",now);

	}

	long double ans=0;

	for(ll i=0;i<k;i++){

		ans+=ch[i];

	}

	long double now=ans;

	for(ll i=0;i<n-k+1;i++){

	//printf("%.10Lf\n",now);		

		now-=ch[i];

		now+=ch[i+k];

		ans=max(now,ans);

	}

	printf("%.10Lf",ans);

	// your code goes here

	return 0;

}

// Optimized solution to the same problem (faster):
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

#define INF 1LL<<62

#define inf 1000000007



int main() {

	ll n,k;

	cin>>n>>k;

	long double ch[200010];

	for(ll i=0;i<n;i++){

		cin>>ch[i];

	}

	long double ans=0;

	for(ll i=0;i<k;i++){

		long double now=ch[i];

		now=(now+1)/2;

		ans+=now;

	}

	long double cnt=ans;

	for(ll i=k;i<n;i++){

		long double now1=ch[i];

		now1=(now1+1)/2;

		long double now2=ch[i-k];

		now2=(now2+1)/2;

		cnt+=now1-now2;

		ans=max(ans,cnt);

	}

	printf("%.10Lf",ans);

	// your code goes here

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<iostream>

#include<stdio.h>

#include<algorithm>

#include<vector>

#include<string.h>

#include<math.h>

#include<map>

#include<iomanip>



#define MOD 1e9+7;

#define INF 1e17+9;

#define PI acos(-1);



using namespace std;



int main() {

	

	vector<double> p(1001,0);

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

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

			p[i]+=(double)(j)/(double)(i);

		}

	}

	

	int n,k;

	cin >> n >> k;

	vector<double> a(n);

	

	for(int i=0;i<n;i++){

		cin >> a[i];

	}

	

	double tot=0;

	for(int i=0;i<k;i++){

		tot+=p[a[i]];

	}

	double ans=tot;

	

	for(int i=k;i<n;i++){

		tot+=p[a[i]];

		tot-=p[a[i-k]];

		ans=max(ans,tot);

	}

	

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

	return 0;

}


// Optimized solution to the same problem (faster):
#include<iostream>

#include<stdio.h>

#include<algorithm>

#include<vector>

#include<string.h>

#include<math.h>

#include<map>

#include<iomanip>



#define MOD 1e9+7;

#define INF 1e17+9;

#define PI acos(-1);



using namespace std;



int main() {

	

	vector<double> p(1001,0);

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

		p[i]+=((double)(i)+1)/2;

	}

	

	int n,k;

	cin >> n >> k;

	vector<double> a(n);

	

	for(int i=0;i<n;i++){

		cin >> a[i];

	}

	

	double tot=0,ans=0;

	for(int i=0;i<k;i++){

		tot+=p[a[i]];

	}

	ans=tot;

	

	for(int i=k;i<n;i++){

		tot+=p[a[i]];

		tot-=p[a[i-k]];

		ans=max(ans,tot);

	}

	

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

	return 0;

}




// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>

#include <algorithm> //next_permutation



using namespace std;

typedef long long ll;

//typedef pair<int, int> P;



int main(){

int n,k;

cin>>n>>k;

vector <double> p(n);

for (int i=0; i<n; i++){

  cin>>p[i];

}





map <double,double> seq;//連想配列クラスタ、erase, find, insert, size, clear. emptyなど

for (int i=0;i<1005;i++){

  double temp=0;

  for (int j=0;j<i+1;j++){

    temp+=j;

}



seq[i]=temp/i;

}



//seq["CCAG"]=5; seq["TT"]=2;

//cout<<seq["TT"]; // 2





int a=0;



vector <double> s(n);

double sub_now=0;

for (int j=0; j<k; j++){

  sub_now+=seq[p[j]];

  //cout<<sub_now<<endl;

}

s[0]=sub_now;

for (int j=1; j<n-k+1; j++){

  s[j]=s[j-1]-seq[p[j-1]]+seq[p[j-1+k]];



}

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



double ans=s.back();

//out << std::fixed << std::setprecision(15) << y << endl;



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







}


// Optimized solution to the same problem (faster):
#include <bits/stdc++.h>

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

using namespace std;

using ll = long long;

using P = pair<ll,ll>;



int main() {

  ios::sync_with_stdio(false);

	cin.tie(0);

  ll n,k;

  cin >> n>>k;

  vector<double> p(n);

  rep(i,n){

    cin>>p[i];

    p[i]+=1;

    p[i]/=2;

  //  cout<<p[i]<<endl;

  }

  double cnt=0;

  rep(i,k)cnt+=p[i];

ll now=0;

double ans=0;

ans=max(ans,cnt);

while(now+k<n){



  cnt-=p[now];

  cnt+=p[now+k];

  ans=max(ans,cnt);

//  cout<<ans<<endl;

  now++;

}

cout<<setprecision(8)<<ans;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <iostream>

#include <iomanip>



int main()

{

    using namespace std;

    

    int n, k;

    double prefix_sum[200001] = {0}, p[200000], ans = 0;

    cin >> n >> k;

    for(int i = 0; i < n; i++){

        cin >> p[i];

        prefix_sum[i + 1] += ((p[i] + 1) / 2 + prefix_sum[i]);

    }

    for(int i = 0; i <= n - k; i++){

        ans = max(ans, prefix_sum[i + k] - prefix_sum[i]);

    }

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

}


// Optimized solution to the same problem (faster):
#include <iostream>

#include <iomanip>

using namespace std;

int main()

{

    double pos[1001];

    double total = 0, sum = 0, maxi = 0;

    for(int i = 1; i <= 1000; i++)

    {

        total += i;

        pos[i] = total / i;

    }

    int n, k;

    cin >> n >> k;

    int a[n];

    for(int i = 0; i < n; i++)

    {

        cin >> a[i];

        if(i < k)

        {

            sum += pos[a[i]];

        }

    }

    maxi = sum;

    for(int i = k - 1; i < n; i++)

    {

        if(i != k - 1)

        {

            sum += pos[a[i]];

        }

        if(sum >= maxi)

        {

            maxi = sum;

        }

        sum -= pos[a[i - k + 1]];

    }

    cout << fixed << setprecision(1) << maxi << endl;

    return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>

using namespace std;

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

#define endl '\n'

#define ll long long





double table[100000];

double cusum[100000];



signed main() {

    int n,k;

    cin >> n >> k;



    vector<double> a(n);

    rep(i,n) cin >> a[i];



    table[0] = 0;

    table[1] = 1;

    for(int i = 2; i < 100000; i++){

        table[i] = table[i-1] + i;

    }

    for(int i = 0; i < n; i++){

        a[i] = table[(int)a[i]] / a[i];

    }

    cusum[0] = a[0];

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

        cusum[i] = cusum[i-1] + a[i];

    }



    double ans = 0;

    for(int i = k - 1; i < n; i++){

        if(i == k - 1) ans = cusum[i];

        else ans = max(ans,cusum[i] - cusum[i - k]);

    }

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

}


// Optimized solution to the same problem (faster):
#include <bits/stdc++.h>

using namespace std;

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

#define int long long



signed main() {

    int n,k;

    cin >> n >> k;



    vector<int> a(n);

    int m = 0;

    for (int i = 0; i < n; i++) {

        cin >> a[i];

        m = max(m,a[i]);

    }



    vector<int> sum(m + 1);

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

        sum[i] = sum[i - 1] + i;

    }



    vector<double> exp(n);

    for (int i = 0; i < n; i++) {

        exp[i] = (double)sum[a[i]] / (double)a[i];

    }



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

        exp[i] += exp[i - 1];

    }



    double ans = 0.0;

    for (int i = k - 1; i < n; i++) {

        double res = 0.0;

        if(i == k - 1) res = exp[i];

        else {

            res = exp[i] - exp[i - k];

        }

        ans = max(ans,res);

    }

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

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<iostream>

#include<cmath>

#include<cstdio>

#include<vector>

#include<algorithm>

 

using namespace std;

 

double EPS = 1e-10;

 

double add(double a,double b){

  if(abs(a+b)<EPS*(abs(a)+abs(b)))return 0;

  return a+b;

}

 

struct point{

  double x,y;

  point() {}

  point(double x,double y):x(x),y(y){

  }

  point operator + (point p){

    return point(add(x,p.x),add(y,p.y));

  }

  point operator - (point p){

    return point(add(x,-p.x),add(y,-p.y));

  }

  point operator * (double d){

    return point(x*d,y*d);

  }

  point operator / (double d){

    return point(x/d,y/d);

  }

};

 

double dist(point a,point b){

	return sqrt(pow(a.x-b.x,2)+pow(a.y-b.y,2));

}

 

int main(void){

	int n,x,y,v;

	vector<point>P;

	vector<double>V;

	

	while(cin >> n,n){

		P.clear();

		V.clear();

		

		for(int i=0;i<n;i++){

			cin >> x >> y >> v;

			P.push_back(point(x,y));

			V.push_back(v);

		}

		

		

		double r=0.999;

		point now(0,0);

		

		for(double d=10;d>EPS;d*=r){

			int mx=0;

			double mxd=0;

			

			for(int j=0;j<P.size();j++){

				if(dist(now,P[j])/V[j]>mxd)mx=j,mxd=dist(now,P[j])/V[j];

			}

			

			now=now+((P[mx]-now)/dist(P[mx],now)*d);

		}

		

		double ans=0;

		for(int i=0;i<P.size();i++){

			ans=max(ans,dist(now,P[i])/V[i]);

		}

		printf("%.8f\n",ans);

	}

	

	return 0;

}

// Optimized solution to the same problem (faster):
#include<iostream>

#include<cmath>

#include<cstdio>

#include<vector>

#include<algorithm>

  

using namespace std;

  

double EPS = 1e-6;

  

double add(double a,double b){

  if(abs(a+b)<EPS*(abs(a)+abs(b)))return 0;

  return a+b;

}

  

struct point{

  double x,y;

  point() {}

  point(double x,double y):x(x),y(y){

  }

  point operator + (point p){

    return point(add(x,p.x),add(y,p.y));

  }

  point operator - (point p){

    return point(add(x,-p.x),add(y,-p.y));

  }

  point operator * (double d){

    return point(x*d,y*d);

  }

  point operator / (double d){

    return point(x/d,y/d);

  }

};

  

double dist(point a,point b){

    return sqrt(pow(a.x-b.x,2)+pow(a.y-b.y,2));

}



int main(void){

    int n,x,y,v;

    vector<point>P;

    vector<double>V;

     

    while(cin >> n,n){

        P.clear();

        V.clear();

         

        for(int i=0;i<n;i++){

            cin >> x >> y >> v;

            P.push_back(point(x,y));

            V.push_back(v);

        }

        

        double r=0.975;

        point now(0,0);

         

        for(double d=10;d>EPS;d*=r){

            int mx=0;

            double mxd=0;

             

            for(int j=0;j<P.size();j++)

                if(dist(now,P[j])/V[j]>mxd)

		  mx=j,mxd=dist(now,P[j])/V[j];

             

            now=now+((P[mx]-now)/dist(P[mx],now)*d);

        }

         

        double ans=0;

        for(int i=0;i<P.size();i++){

	  ans=max(ans,dist(now,P[i])/V[i]);

        }

        printf("%.8f\n",ans);

    }

    return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<iostream>

#include<cmath>

#include<cstdio>

#include<vector>

#include<algorithm>

 

using namespace std;

 

double EPS = 1e-10;

 

double add(double a,double b){

  if(abs(a+b)<EPS*(abs(a)+abs(b)))return 0;

  return a+b;

}

 

struct point{

  double x,y;

  point() {}

  point(double x,double y):x(x),y(y){

  }

  point operator + (point p){

    return point(add(x,p.x),add(y,p.y));

  }

  point operator - (point p){

    return point(add(x,-p.x),add(y,-p.y));

  }

  point operator * (double d){

    return point(x*d,y*d);

  }

  point operator / (double d){

    return point(x/d,y/d);

  }

};

 

double dist(point a,point b){

	return sqrt(pow(a.x-b.x,2)+pow(a.y-b.y,2));

}

 

int main(void){

	int n,x,y,v;

	vector<point>P;

	vector<double>V;

	

	while(cin >> n,n){

		P.clear();

		V.clear();

		

		for(int i=0;i<n;i++){

			cin >> x >> y >> v;

			P.push_back(point(x,y));

			V.push_back(v);

		}

		

		

		double r=0.99;

		point now(0,0);

		

		for(double d=10;d>1e-8;d*=r){

			int mx=0;

			double mxd=0;

			

			for(int j=0;j<P.size();j++){

				if(dist(now,P[j])/V[j]>mxd)mx=j,mxd=dist(now,P[j])/V[j];

			}

			

			now=now+((P[mx]-now)/dist(P[mx],now)*d);

		}

		

		double ans=0;

		for(int i=0;i<P.size();i++){

			ans=max(ans,dist(now,P[i])/V[i]);

		}

		printf("%.8f\n",ans);

	}

	

	return 0;

}

// Optimized solution to the same problem (faster):
#include<iostream>

#include<cmath>

#include<cstdio>

#include<vector>

#include<algorithm>

  

using namespace std;

  

double EPS = 1e-6;

  

double add(double a,double b){

  if(abs(a+b)<EPS*(abs(a)+abs(b)))return 0;

  return a+b;

}

  

struct point{

  double x,y;

  point() {}

  point(double x,double y):x(x),y(y){

  }

  point operator + (point p){

    return point(add(x,p.x),add(y,p.y));

  }

  point operator - (point p){

    return point(add(x,-p.x),add(y,-p.y));

  }

  point operator * (double d){

    return point(x*d,y*d);

  }

  point operator / (double d){

    return point(x/d,y/d);

  }

};

  

double dist(point a,point b){

    return sqrt(pow(a.x-b.x,2)+pow(a.y-b.y,2));

}



int main(void){

    int n,x,y,v;

    vector<point>P;

    vector<double>V;

     

    while(cin >> n,n){

        P.clear();

        V.clear();

         

        for(int i=0;i<n;i++){

            cin >> x >> y >> v;

            P.push_back(point(x,y));

            V.push_back(v);

        }

        

        double r=0.975;

        point now(0,0);

         

        for(double d=10;d>EPS;d*=r){

            int mx=0;

            double mxd=0;

             

            for(int j=0;j<P.size();j++)

                if(dist(now,P[j])/V[j]>mxd)

		  mx=j,mxd=dist(now,P[j])/V[j];

             

            now=now+((P[mx]-now)/dist(P[mx],now)*d);

        }

         

        double ans=0;

        for(int i=0;i<P.size();i++){

	  ans=max(ans,dist(now,P[i])/V[i]);

        }

        printf("%.8f\n",ans);

    }

    return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <set>

#include <cstdio>

#include <algorithm>

#include <queue>

#include <cstdlib>

#include <complex>



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

inline int getInt(){ int s; scanf("%d", &s); return s; }



using namespace std;



typedef complex<double> P;



int main(){

  while(const int n = getInt()){

    vector<P>   pos(n);

    vector<double> v(n);



    REP(i,n){

      const int x = getInt();

      const int y = getInt();

      v[i] = getInt();

      pos[i] = P(x, y);

    }



    const double r = 0.99;

    P p(0, 0);



    auto calc = [&](P p){

      auto mx = make_pair(0.0, 0);

      REP(i,n) mx = max(mx, make_pair(abs(p - pos[i]) / v[i], i));

      return mx;

    };



    for(double d = 1000; d > 1e-8; d *= r){

      auto mx = calc(p).second;

      p += (pos[mx] - p) / abs(pos[mx] - p) * d;

    }



    printf("%.8f\n", calc(p).first);

  }



  return 0;

}

// Optimized solution to the same problem (faster):
#include <set>

#include <cstdio>

#include <algorithm>

#include <queue>

#include <cstdlib>

#include <complex>



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

inline int getInt(){ int s; scanf("%d", &s); return s; }



using namespace std;



typedef complex<double> P;



int main(){

  while(const int n = getInt()){

    vector<P>   pos(n);

    vector<double> v(n);



    REP(i,n){

      const int x = getInt();

      const int y = getInt();

      v[i] = getInt();

      pos[i] = P(x, y);

    }



    const double r = 0.98;

    P p(0, 0);



    auto calc = [&](P p){

      auto mx = make_pair(0.0, 0);

      REP(i,n) mx = max(mx, make_pair(abs(p - pos[i]) / v[i], i));

      return mx;

    };



    for(double d = 1000; d > 1e-8; d *= r){

      auto mx = calc(p).second;

      p += (pos[mx] - p) / abs(pos[mx] - p) * d;

    }



    printf("%.8f\n", calc(p).first);

  }



  return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <cstdio>

#include <algorithm>

#include <cmath>

using namespace std;



// 入力

int N;

double x[101], y[101], v[101];



// 2点間の距離

double dist(double x1, double y1, double x2, double y2){

	return sqrt( (x1-x2) * (x1-x2) + (y1-y2) * (y1-y2) );

}



// (x_,y_) => (x[i],y[i]) (0 <= i < N)の移動時間で最大のものを返す.

double g(double x_, double y_){

	double t = 0;

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

		double d = dist( x_ , y_ , x[i] , y[i]);

		t = max( t , d / v[i] );

	}

	return t;

}



// x が与えられた時, y について三分探索 (0 <= y <= 100)

double f(double x, double low=0, double high=100){

	for (int i = 0 ; i < 100 ; i++ ){

		double a = (low * 2 + high) / 3;

		double b = (low + high * 2) / 3;

		if( g(x, a) < g(x, b) ){

			high = b;

		}else{

			low = a;

		}

	}

	return g(x, (low + high) / 2);

}



// x について三分探索 (0 <= x <= 100)

double search(double low=0, double high=100){

	for (int i = 0 ; i < 100 ; i++ ){

		double a = (low * 2 + high) / 3;

		double b = (low + high * 2) / 3;

		if( f(a) < f(b) ){

			high = b;

		}else{

			low = a;

		}

	}

	return f((low + high) / 2) ;

}



int main(){

	while( scanf("%d", &N) ){

		if( N == 0 ) break;

		

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

			scanf("%lf %lf %lf", &x[i], &y[i], &v[i]);

		}

		double ans = search();

		printf("%.8f\n", ans);

	}

}

// Optimized solution to the same problem (faster):
#include <cstdio>

#include <cmath>

#include <algorithm>

using namespace std;



const int MAX_LOOP = 86;

const int MAX_N = 100;

int n;

double x[MAX_N], y[MAX_N], v[MAX_N];



double dist(double x, double y, double x_, double y_){

	return sqrt((x - x_) * (x - x_) + (y - y_) * (y - y_));

}



double h(double px, double py){

	double res = 0;

	for(int i=0 ; i < n ; i++ ){

		double d = dist(px, py, x[i], y[i]);

		double t = d / v[i];

		res = max(res, t);

	}

	return res;

}



double g(double left, double right, double py){

	for(int i=0 ; i < MAX_LOOP ; i++ ){

		double mid1 = (left * 2 + right) / 3;

		double mid2 = (left + right * 2) / 3;

		if( h(mid1, py) < h(mid2, py) ){

			right = mid2;

		}else{

			left = mid1;

		}

	}

	return h((left + right) / 2, py);

}



double f(double left, double right){

	for(int i=0 ; i < MAX_LOOP ; i++ ){

		double mid1 = (left * 2 + right) / 3;

		double mid2 = (left + right * 2) / 3;

		if( g(0, 100, mid1) < g(0, 100, mid2) ){

			right = mid2;

		}else{

			left = mid1;

		}

	}

	return g(0, 100, (left + right) / 2);

}



int main(){

	while( scanf("%d", &n), n ){

		for(int i=0 ; i < n ; i++ ){

			scanf("%lf %lf %lf", &x[i], &y[i], &v[i]);

		}

		double ans = f(0,100);

		printf("%.8f\n", ans);

	}

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>



#ifndef ONLINE_JUDGE

	#define W(x, y) cerr << "\033[31m" << #x << " = " << x << "\033[0m" << y;

#else

	#define W(x, y)

#endif





#define ll long long

#define pii pair<int, int>

#define pll pair<ll, ll>

#define vi vector<int>

#define vii vector<pii>

#define vl vector<ll>

#define vll vector<pll>

#define pb push_back

#define mp make_pair

#define ff first

#define ss second

#define pi acos(-1)

#define ld long double

#define prime (1000000000 + 7)



using namespace std;



#define INF 1000000000







int main(){

	ios::sync_with_stdio(false);

	cin.tie(0); cout.tie(0);



	

	string s;

	cin >> s;



	stack<ll> pilha;

	for(int i = 0; i < s.size(); ++i){

		if(pilha.empty()){

			pilha.push(s[i]);

		} else{

			if(pilha.top() != s[i]){

				pilha.pop();

			} else{

				pilha.push(s[i]);

			}

		}

	}

	cout << s.size() - pilha.size() << endl;



	return 0;

}

// Optimized solution to the same problem (faster):
#include<cstdio>

#include<cstring>

#include<stack>

using namespace std;



char s[100005];

int main()

{

    int num=0;

    int i;

    stack<char>c;

    scanf("%s",s);

    int len=strlen(s);

    for(i=0;i<=len-1;i++)

    {

        if(c.empty()||c.top()==s[i])

            c.push(s[i]);

        else

        {

            c.pop();

            num+=2;

        }

    }

    printf("%d",num);

    return 0;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <iostream>

#include <string>

#include <stack>

#include <exception>



using namespace std;



int main(){

    string S; cin >> S;

    stack<char> ST;



    for (int i = 0; i < S.size(); i++){

        try {

            if (ST.empty()) throw "empty stack!";

            if (ST.top() != S[i]) ST.pop();

            else                  ST.push(S[i]);

        } catch (const char *error) {

            ST.push(S[i]);

        }

    }



    cout << S.size()-ST.size() << endl;

    return 0;

}


// Optimized solution to the same problem (faster):
#include<cstdio>

#include<cstring>

#include<stack>

using namespace std;



char s[100005];

int main()

{

    int num=0;

    int i;

    stack<char>c;

    scanf("%s",s);

    int len=strlen(s);

    for(i=0;i<=len-1;i++)

    {

        if(c.empty()||c.top()==s[i])

            c.push(s[i]);

        else

        {

            c.pop();

            num+=2;

        }

    }

    printf("%d",num);

    return 0;

}


// Fastest known solution for this problem: