Language: C++

#include <iostream>
#include <cmath>
#include <complex>
#include <tuple>
#include <vector>
using namespace std;

using vec = complex<double>;
using line = pair<vec,vec>;
using polygon = vector<vec>;
const double eps = 0.0000001;

double inner_product(vec u,vec v){
    return real(u*conj(v));
}
double cross_product(vec u,vec v){
    return imag(conj(u)*v);
}

vec projection(line l,vec p){//p???l???????°???±
    vec s=l.first, t=l.second;
    double k = inner_product(t-s,p-s)/inner_product(t-s,t-s);
    return (1.0-k)*s+k*t;
}

vec reflection(line l,vec p){
    return 2.0*projection(l,p)-p;
}

int ccw(vec& a, vec& b, vec& c){
    vec ab = b-a, ac = c-a;
    double o = cross_product(ab,ac);
    if(o>0) return 1; //CCW
    if(o<0) return -1; //CW
    if(inner_product(ab,ac)<0){
        return 2; //C-A-B
    }else{
        if(inner_product(ab,ab)<inner_product(ac,ac)){
            return -2; //A-B-C
        }else{
            return 0; //A-C-B
        }
    }
}

bool isIntersect(line l0, line l1){
    int s = ccw(l0.first,l0.second,l1.first)*ccw(l0.first,l0.second,l1.second);
    if(s!=0&&s!=-1&&s!=-4) return false;
    s=ccw(l1.first,l1.second,l0.first)*ccw(l1.first,l1.second,l0.second);
    if(s!=0&&s!=-1&&s!=-4) return false;
    else return true;
}

vec interSection(line l0, line l1){
    vec s0, t0, s1, t1;
    tie(s0,t0)=l0; tie(s1,t1)=l1;
    double k = cross_product(t1-s1,s1-s0)/cross_product(t1-s1,t0-s0);
    return s0+(t0-s0)*k;
}

double segLength(line l){
    return abs(l.first-l.second);
}

double distLine2point(line l, vec p){
    return abs(cross_product(l.second-l.first,p-l.first))/abs(l.second-l.first);
}

double distSeg2Point(line l, vec p){
    vec x = projection(l,p);
    double L = segLength(l);
    if(abs(x-l.first)<L&&abs(x-l.second)<L){
        return abs(x-p);
    }else{
        return min(abs(l.first-p),abs(l.second-p));
    }
}

double distSeg2Seg(line l1, line l2){
    if(isIntersect(l1,l2)) return 0;
    double ret = 1e20;
    ret = min(ret,distSeg2Point(l1,l2.first));
    ret = min(ret,distSeg2Point(l1,l2.second));
    swap(l1,l2);
    ret = min(ret,distSeg2Point(l1,l2.first));
    ret = min(ret,distSeg2Point(l1,l2.second));
    return ret;
}

double area(polygon& g){
    double S=0;
    int n=g.size();
    for(int i=0;i<n;i++){
        S+=cross_product(g[i],g[(i+1)%n]);
    }
    S/=2;
    return S;
}

pair<vec,vec> cross_point(vec C, double r, line l){
    vec P1,P2,P,s,t; tie(s,t)=l;
    P=(t-s)*(inner_product(t-s,C-s)/norm(t-s))+s;
    P1=P+(t-s)*(sqrt(r*r-norm(P-C))/abs(t-s));
    P2=P-(t-s)*(sqrt(r*r-norm(P-C))/abs(t-s));
    if(P1.real()==P2.real()){
        if(P1.imag()<P2.imag()) return make_pair(P1,P2);
        else return make_pair(P2,P1);
    }else{
        if(P1.real()<P2.real()) return make_pair(P1,P2);
        else return make_pair(P2,P1);
    }
}

vec rotate(vec v, double rad){
    return v*polar(1.0,rad);
}

pair<vec,vec> cross_point(vec C1, vec C2, double r1, double r2){
    vec e1,e2,P1,P2;
    double d=abs(C2-C1);
    e1=(C2-C1)*(1/d);
    double theta = acos((r1*r1+norm(C2-C1)-r2*r2)/(2*r1*d));
    P1=C1+rotate(e1,theta)*r1;
    P2=C1+rotate(e1,-theta)*r1;
    if(P1.real()==P2.real()){
        if(P1.imag()<P2.imag()) return make_pair(P1,P2);
        else return make_pair(P2,P1);
    }else{
        if(P1.real()<P2.real()) return make_pair(P1,P2);
        else return make_pair(P2,P1);
    }
}

int main(){
    int N;
    while(cin>>N,N){
        int sx,sy,ex,ey;
        cin>>sx>>sy>>ex>>ey;
        line L(vec(sx,sy),vec(ex,ey));
        double r=1e8;
        for(int i=0;i<N;i++){
            int x,y,X,Y,h;
            cin>>x>>y>>X>>Y>>h;
            vec v0(x,y),v1(X,y),v2(x,Y),v3(X,Y);
            line l0(v0,v1),l1(v1,v3),l2(v3,v2),l3(v2,v0);
            double d = min({distSeg2Seg(L,l0),distSeg2Seg(L,l1),distSeg2Seg(L,l2),distSeg2Seg(L,l3)});
            if(x<=min(sx,ex)&&y<=min(sy,ey)&&X>=max(sx,ex)&&Y>=max(sy,ey)) d=0;
            if(d<1e-5){
                r=0;
            }else{
                if(h>=d){
                    r=min(r,d);
                }else{
                    r=min(r,(h*h+d*d)/(2*h));
                }
            }
        }
        cout<<r<<endl;
    }

}

Compiler output:
a.cc: In function 'int main()':
a.cc:146:27: error: no matching function for call to 'min(<brace-enclosed initializer list>)'
  146 |             double d = min({distSeg2Seg(L,l0),distSeg2Seg(L,l1),distSeg2Seg(L,l2),distSeg2Seg(L,l3)});
      |                        ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/string:51,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  233 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note:   candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  281 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note:   candidate expects 3 arguments, 1 provided