Language: C++

#ifndef ___Geometry_Library
#define ___Geometry_Library

// ------ Includes ------ //
#include <cmath>
#include <complex>
#include <utility>
#include <algorithm>

// ------ Defines ------ //
typedef long double GType;
typedef std::complex<GType> Point;
typedef std::pair<Point, Point> Segment;

// ------ Constants ------ //
const GType EPS = 1.0e-10L;

// ------ Functions Level 1 ------ //
GType dot(const Point& p1, const Point& p2) {
	return (std::conj(p1) * p2).real();
}
GType cross(const Point& p1, const Point& p2) {
	return (std::conj(p1) * p2).imag();
}
int ccw(const Point& p1, const Point& p2, const Point& p3) {
	Point v1 = p2 - p1, v2 = p3 - p1;
	if (cross(v1, v2) > EPS) return +1;
	if (cross(v1, v2) < -EPS) return -1;
	if (dot(v1, v2) < -EPS) return +2;
	if (std::norm(v1) < std::norm(v2)) return -2;
	return 0;
}

// ------ Functions Level 2 ------ //
bool intersect(const Segment& s1, const Point& p1, bool segflag) {
	if (!segflag) return std::abs(cross(s1.second - p1, s1.first - p1)) < EPS;
	return (std::abs(s1.first - p1) + std::abs(s1.second - p1) - std::abs(s1.second - s1.first)) < EPS;
}
bool intersect(const Segment& s1, const Segment& s2, bool segflag) {
	if (!segflag) return cross(s1.second - s1.first, s2.first - s1.first) * cross(s1.second - s1.first, s2.second - s1.first) < EPS;
	return (ccw(s1.first, s1.second, s2.first) * ccw(s1.first, s1.second, s2.second)) <= 0 && (ccw(s2.first, s2.second, s1.first) * ccw(s2.first, s2.second, s1.second)) <= 0;
}
Point crosspoint(const Segment& s1, const Segment& s2) {
	GType r1 = cross(s1.second - s1.first, s2.second - s2.first);
	GType r2 = cross(s1.second - s1.first, s1.second - s2.first);
	if (std::abs(r1) < EPS && std::abs(r2) < EPS) return s2.first;
	return s2.first + r2 / r1 * (s2.second - s2.first);
}

#endif

#include <iomanip>
#include <iostream>
using namespace std;
int q, xa, ya, xb, yb; Segment s1, s2;
int main() {
	cin >> q;
	while (q--) {
		cin >> xa >> ya >> xb >> yb; s1 = make_pair(Point(xa, ya), Point(xb, yb));
		cin >> xa >> ya >> xb >> yb; s2 = make_pair(Point(xa, ya), Point(xb, yb));
		cout << fixed << setprecision(15) << distance(s1, s2) << endl;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:61:62: error: no matching function for call to 'distance(Segment&, Segment&)'
   61 |                 cout << fixed << setprecision(15) << distance(s1, s2) << endl;
      |                                                      ~~~~~~~~^~~~~~~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:66,
                 from /usr/include/c++/14/bits/specfun.h:43,
                 from /usr/include/c++/14/cmath:3906,
                 from a.cc:5:
/usr/include/c++/14/bits/stl_iterator_base_funcs.h:148:5: note: candidate: 'template<class _InputIterator> constexpr typename std::iterator_traits< <template-parameter-1-1> >::difference_type std::distance(_InputIterator, _InputIterator)'
  148 |     distance(_InputIterator __first, _InputIterator __last)
      |     ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator_base_funcs.h:148:5: note:   template argument deduction/substitution failed:
/usr/include/c++/14/bits/stl_iterator_base_funcs.h: In substitution of 'template<class _InputIterator> constexpr typename std::iterator_traits< <template-parameter-1-1> >::difference_type std::distance(_InputIterator, _InputIterator) [with _InputIterator = std::pair<std::complex<long double>, std::complex<long double> >]':
a.cc:61:48:   required from here
   61 |                 cout << fixed << setprecision(15) << distance(s1, s2) << endl;
      |                                                      ~~~~~~~~^~~~~~~~
/usr/include/c++/14/bits/stl_iterator_base_funcs.h:148:5: error: no type named 'difference_type' in 'struct std::iterator_traits<std::pair<std::complex<long double>, std::complex<long double> > >'
  148 |     distance(_InputIterator __first, _InputIterator __last)
      |     ^~~~~~~~