Language: C++

#include <cmath>
#include <cstdlib>
#include <iostream>
#include <vector>
 using namespace std;

 constexpr double EPS = 1e-9;

 struct point {
	 double x, y;
	 explicit point(double x_ = 0.0, double y_ = 0.0):x(x_), y(y_) {}
	 point(const point &p):x(p.x), y(p.y) {}

	 point operator+ (const point &p) const {
		 return point(x + p.x, y + p.y);
	 }

	 point operator- (const point &p) const {
		 return point(x - p.x, y - p.y);
	 }

	 point operator* (double s) const {
		 return point(x * s, y * s);
	 }

	 point operator* (const point &p) const {
		 return point(x * p.x - y * p.y, x * p.y + y * p.x);
	 }

	 point operator/ (double s) const {
		 return point(x / s, y / s);
	 }

	 bool operator< (const point &p) const {
		 return x + EPS < p.x || (abs(x - p.x) < EPS && y + EPS < p.y);
	 }

	 bool operator== (const point &p) const {
		 return abs(x - p.x) < EPS && abs(y - p.y) < EPS;
	 }
 };

 double norm(const point &p) {
	 return p.x * p.x + p.y * p.y;
 }

 double abs(const point &p) {
	 return sqrt(norm(p));
 }

 double dot(const point &a, const point &b) {
	 return a.x * b.x + a.y * b.y;
 }

 double cross(const point &a, const point &b) {
	 return a.x * b.y - a.y * b.x;
 }

 struct segment {
	 point a, b;
	 segment(const point &a_, const point &b_):a(a_), b(b_){}
 };

 struct line {
	 point a, b;
	 line(const point &a_, const point &b_):a(a_), b(b_){}
 };

 int ccw(const point &a, point b, point c) {
	 b = b - a;
	 c = c - a;
	 const double tmp = cross(b, c);
	 if(tmp > EPS) return 1; // ccw
	 if(tmp < -EPS) return -1; // cw
	 if(dot(b, c) < 0) return 2; // c, a, b 順に一直線上
	 if(norm(b) < norm(c)) return -2; // a, b, c 順に一直線上
	 return 0; //a, c, b 順で一直線上
 }

 bool intersect(const segment &s, const segment &t) {
	 return ccw(s.a, s.b, t.a) * ccw(s.a, s.b, t.b) <= 0
		 && ccw(t.a, t.b, s.a) * ccw(t.a, t.b, s.b) <= 0;
 }

 double dist(const line &l, const point &p) {
	 return abs(cross(l.b - l.a, p - l.a)) / abs(l.b - l.a);
 }

 double dist(const segment &s, const point &p) {
	 if(dot(s.b - s.a, p - s.a) < 0) return abs(p - s.a);
	 if(dot(s.a - s.b, p - s.b) < 0) return abs(p - s.b);
	 return dist(line(s.a, s.b), p);
 }

 double dist(const segment &s, const segment &t) {
	 if(intersect(s, t)) return 0;
	 return min({dist(s, t.a), dist(s, t.b), dist(t, s.a), dist(t, s.b)});
 }

 vector<point> input_polylines() {
	 int n;
	 cin >> n;

	 vector<point> res;
	 res.reserve(n);

	 for(int i = 0; i < n; ++i) {
		 int x, y;
		 cin >> x >> y;
		 res.emplace_back(x, y);
	 }

	 return res;
 }

 int main() {
	 cin.tie(nullptr);
	 ios::sync_with_stdio(false);
	 cout.setf(ios::fixed);
	 cout.precision(10);

	 const vector<point> P1 = input_polylines();
	 const vector<point> P2 = input_polylines();

	 double ans = INT_MAX;
	 for(unsigned i = 1; i < P1.size(); ++i) {
		 for(unsigned j = 1; j < P2.size(); ++j) {
			 ans = min(ans, dist(segment(P1[i], P1[i - 1]), segment(P2[j], P2[j - 1])));
		 }
	 }

	 cout << ans << endl;

	return EXIT_SUCCESS;
}

Compiler output:
a.cc: In function 'double dist(const segment&, const segment&)':
a.cc:97:20: error: no matching function for call to 'min(<brace-enclosed initializer list>)'
   97 |          return min({dist(s, t.a), dist(s, t.b), dist(t, s.a), dist(t, s.b)});
      |                 ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/bits/specfun.h:43,
                 from /usr/include/c++/14/cmath:3906,
                 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
a.cc: In function 'int main()':
a.cc:125:23: error: 'INT_MAX' was not declared in this scope
  125 |          double ans = INT_MAX;
      |                       ^~~~~~~
a.cc:5:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    4 | #include <vector>
  +++ |+#include <climits>
    5 |  using namespace std;