Go: package main

import (
	"fmt"
	"math"
)

func main() {
	x := -1
	h := -1
	for {
		fmt.Scan(&x)
		fmt.Scan(&h)
		if x == 0 && h == 0 {
			return
		}

		f_x := float64(x) / 2.0

		sya := math.Sqrt(f_x*f_x + float64(h*h))
		fmt.Println(float64(x*x) + float64(x)*sya*2.0)

	}
}

C++: #include<stdio.h>
#include<stdlib.h>
#include<iostream>
#include<string>
#include<string.h>
#include<vector>
#include<math.h>
#include<queue>
#include <algorithm>
#include<functional>
#include<cstdlib>
#include<cmath>


#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define CI cin >>
#define CO cout <<
#define E << endl;

using namespace std;

typedef pair<int, int> P;
typedef pair<long, long> LP;
typedef pair<int, P> PP;
typedef pair<long, LP> LPP;



int dy[] = { 0, 0, 1, -1, 0 };
int dx[] = { 1, -1, 0, 0, 0 };


double X = 0;
double H = 0;

void input(void) {
	CI X;
	CI H;

	return;
}


int main(void) {
	while (1) {
		input();
		if (X == 0 && H == 0) {
			return 0;
		}
		printf("%.7f", X * X + 2 * X * sqrt(H * H + X * X / 4.0));
	}

	return 0;
}

C++: #include<stdio.h>
#include<stdlib.h>
#include<iostream>
#include<string>
#include<string.h>
#include<vector>
#include<math.h>
#include<queue>
#include <algorithm>
#include<functional>
#include<cstdlib>
#include<cmath>


#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define CI cin >>
#define CO cout <<
#define E << endl;

using namespace std;

typedef pair<int, int> P;
typedef pair<long, long> LP;
typedef pair<int, P> PP;
typedef pair<long, LP> LPP;



int dy[] = { 0, 0, 1, -1, 0 };
int dx[] = { 1, -1, 0, 0, 0 };


double X = 0;
double H = 0;

void input(void) {
	CI X;
	CI H;

	return;
}


int main(void) {
	while (1) {
		input();
		if (X == 0 && H == 0) {
			return 0;
		}
		printf("%.7f\n", (X * X) + (2 * X * sqrt((H * H) + (X * X) / 4.0)));
	}

	return 0;
}

C++: #include <iostream>
#include <cmath>
#include <cstdio>

using namespace std;

int main(){

	double x, h;

	while(cin>>x>>h, x+h){
		double c = sqrt( ( (x/2)*(x/2) ) + (h*h) );
		printf("%.6f\n", ( x*x + 2*c*x ) );
	}
	return 0;
}

C++: #include<iostream>
#include<cstdio>
#include<string>
#include<math.h>

using namespace std;

int main()
{	
	double x,h;
	double ans,height;
	while(cin>>x>>h,x!=0){
		height=sqrt(h*h+x*x/4);
		ans=0;
		ans+=x*x+height*x*2;
		printf("%.5lf",ans);
	}
	return 0;
}

C++: #include<iostream>
#include<cstdio>
#include<vector>
#include<utility>
#include<algorithm>
using namespace std;
int main(){
	for(;;){
		int n,m,sum = 0;
		cin >>n;
		if(!n){break;}
		cin >>m;
		vector<pair<int, pair<int,int> > > edge;
		bool done[100] = {false};
		for(int i=0; i<m ;i++){
			int a,b,cost;
			scanf("%d,%d,%d",&a,&b,&cost);
			edge.push_back(make_pair(cost,make_pair(a,b)));
		}
		sort(edge.begin(),edge.end());
		done[edge[0].second.first] = true;
		done[edge[0].second.second] = true;
		sum += edge[0].first/100;
		if(!(edge[0].first%100)){sum--;}
		for(int i=0; i<n-1; i++){
			for(int k=0; k<m; k++){
				if(done[edge[k].second.first]^done[edge[k].second.second]){
					sum += edge[k].first/100;
					if(!(edge[k].first%100)){sum--;}
					done[edge[k].second.first] = true;
					done[edge[k].second.second] = true;
					break;
				}
			}
		}
		cout<<sum<<endl;
	}
	return 0;
}

C++: #include<iostream>
#include<cmath>
#include<iomanip>
using namespace std;

int main()
{
    double x, h;

    while( cin >> x >> h )
    {
        if( x == 0 && h == 0 )
            break;
        
        //側面積=0.5*x*t, t = root(h^2+0.25x^2), 余弦
        double s = 0;
        s = 2 * x * sqrt( h * h + 0.25 * x * x ) + x * x;

        cout << fixed << setprecision(8) << s << endl;
    }
    return 0;
}

C++: #include <iostream>
#include <utility>
#include <algorithm>
#include <string>
#include <vector>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cstdlib>

typedef long long int ll;


using namespace std;

int x,h;
double y;
double ans;

int main(){
	while(1){
		cin>>x>>h;
		if(x==0&&h==0)break;
		y=sqrt(4*h*h+x*x)/2.0;
		ans=x*(2*y+x);
		printf("%.15lf",ans);
	}
}

C++: #include <iostream>
#include <cstdio>
#include <cmath>

int main(){
	while(1){
		int x, h;
		double s=0;
		
		scanf(" %d %d", &x, &h);
		if(x==0) break;
		
		s += x*x;
		
		double r = sqrt(h*h + x*x/4.0);
		s += x*r*2; 
	
		printf("%lf\n", s);	
	}

	return 0;
}

C++: #include <iostream>
#include <cmath>
using namespace std;

int main() {
	int x, h;
	while (cin >> x >> h) {
		if (x == 0 && h == 0) break;
		cout << x * x + hypot(x / 2.0, h) * x * 2.0 << endl;;
	}
}

C++: #include <bits/stdc++.h>

using namespace std;

int main()
{
  double x, h;
  while(cin >> x >> h, x || h){
    printf("%.6f\n", (double)x*x + 2.0 * sqrt(h*h + x*x/4) * x);
  }
  return 0;
}

C++: #include <algorithm>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <cctype>
#include <iostream>
#include <set>
#include <string>
#include <queue>
#include <map>
using namespace std;
int size(string x){
	string::size_type size=x.size();
	return size;
}
#define fu(l,k) for(int i=l;i<k;i++)
#define fd(l,k) for(int i=l;i>k;i--)
#define fi first
#define se second
typedef  vector<string> vs;
typedef  vector<int> vi;
double pi(){
	return M_PI;
}
typedef set<int> set_i;
typedef set<string> set_s;
int INF=1000000;
int main(){
	int x,h;
	double ssr,sr;
	while(1){
		cin>>x;
		cin>>h;
		if(x==0&&h==0) break;
		sr=sqrt(h*h+(x*x)/4.0);
		ssr=sr*x*2+x*x;
		printf("%.8lf\n", ssr);
	}
}

C++: #include <bits/stdc++.h>

using namespace std;

int main()
{
    double S, x, h;
 
    while (cin >> x >> h, (x != 0 || h != 0)) {
        S = (sqrt(h * h + x * x / 4) * 2 + x) * x;
        printf("%.6f\n" ,S);
    }
    return 0;
}

C++: loop do
  x, h = 2.times.map{gets.to_i}
  break if x==0 && h==0
  puts x*x+Math.sqrt(4*h*h+x*x)*x
end

C++: // clang-format off
#include <bits/stdc++.h>
#define int long long
#define main signed main()
// #define main int main()
#define loop(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) loop(i, 0, n)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define prec(n) fixed << setprecision(n)
#define stlice(from, to) substr(from, (to) - (from) + 1)
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
using namespace std;
using pii = pair<int, int>;
using vi = vector<int>;
using vd = vector<double>;
using vc = vector<char>;
using vb = vector<bool>;
using vs = vector<string>;
using vpii = vector<pii>;
using vvi = vector<vi>;
using vvb = vector<vb>;
using vvpii = vector<vpii>;
template<typename A> using fn = function<A>;
constexpr int INF = sizeof(int) == sizeof(long long) ? 1000000000000000000LL : 1000000000;
constexpr int MOD = 1000000007;
constexpr double PI = acos(-1);
template<typename A, typename B> bool cmin(A &a, const B &b) { return a > b ? (a = b, true) : false; }
template<typename A, typename B> bool cmax(A &a, const B &b) { return a < b ? (a = b, true) : false; }
constexpr bool odd(const int &n) { return n & 1; }
constexpr bool even(const int &n) { return !odd(n); }
template<typename V> constexpr typename V::value_type sum(const V &v) { return accumulate(all(v), 0); }
void solve();
main { solve(); return 0; }
// clang-format on

void solve() {
  double x, h;
  while (cin >> x >> h, x) {
    cout << prec(8) << x * x + x * hypot(h, x / 2) * 2 << endl;
  }
}

C++: #include <cstdio>
#include <cmath>
int main()
{
	int x, h;
	while (scanf("%d%d", &x, &h))
	{
		if (x == 0.0 && h == 0.0) break;
		printf("%.6f\n", (4.0*(sqrt(double(h*h)+double(x*x)/4.0)*x))/2.0+x*x);
	}
}