Language: C++

#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
 
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
 
using namespace std;
using namespace __gnu_pbds;
 
typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;
 
typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;
 
typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;
 
template <class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;
 
#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)
 
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
 
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
 
const int MOD = 1000000007;
const ll INF = 1e18;
const int MX = 100001; //check the limits, dummy
// SOURCE:  nayuki.io
struct Point final {
	
	public: double x;
	public: double y;
	
	
	public: Point subtract(const Point &p) const;
	
	public: double distance(const Point &p) const;
	
	// Signed area / determinant thing
	public: double cross(const Point &p) const;
	
};
 
 
struct Circle final {
	
	public: static const Circle INVALID;
	
	private: static const double MULTIPLICATIVE_EPSILON;
	
	
	public: Point c;   // Center
	public: double r;  // Radius
	
	
	public: bool contains(const Point &p) const;
	
	public: bool contains(const std::vector<Point> &ps) const;
	
};
 
/*---- Members of struct Point ----*/
 
Point Point::subtract(const Point &p) const {
	return Point{x - p.x, y - p.y};
}
 
 
double Point::distance(const Point &p) const {
	return std::hypot(x - p.x, y - p.y);
}
 
 
double Point::cross(const Point &p) const {
	return x * p.y - y * p.x;
}
 
 
/*---- Members of struct Circle ----*/
 
const Circle Circle::INVALID{Point{0, 0}, -1};
 
const double Circle::MULTIPLICATIVE_EPSILON = 1 + 1e-14;
 
 
bool Circle::contains(const Point &p) const {
	return c.distance(p) <= r * MULTIPLICATIVE_EPSILON;
}
 
 
bool Circle::contains(const vector<Point> &ps) const {
	for (const Point &p : ps) {
		if (!contains(p))
			return false;
	}
	return true;
}
 
 
/*---- Smallest enclosing circle algorithm ----*/
 
static Circle makeSmallestEnclosingCircleOnePoint (const vector<Point> &points, size_t end, const Point &p);
static Circle makeSmallestEnclosingCircleTwoPoints(const vector<Point> &points, size_t end, const Point &p, const Point &q);
 
static std::default_random_engine randGen((std::random_device())());
Circle makeDiameter(const Point &a, const Point &b) {
	Point c{(a.x + b.x) / 2, (a.y + b.y) / 2};
	return Circle{c, max(c.distance(a), c.distance(b))};
}
Circle makeCircumcircle(const Point &a, const Point &b, const Point &c) {
	// Mathematical algorithm from Wikipedia: Circumscribed circle
	double ox = (min(min(a.x, b.x), c.x) + max(min(a.x, b.x), c.x)) / 2;
	double oy = (min(min(a.y, b.y), c.y) + max(min(a.y, b.y), c.y)) / 2;
	double ax = a.x - ox,  ay = a.y - oy;
	double bx = b.x - ox,  by = b.y - oy;
	double cx = c.x - ox,  cy = c.y - oy;
	double d = (ax * (by - cy) + bx * (cy - ay) + cx * (ay - by)) * 2;
	if (d == 0)
		return Circle::INVALID;
	double x = ((ax*ax + ay*ay) * (by - cy) + (bx*bx + by*by) * (cy - ay) + (cx*cx + cy*cy) * (ay - by)) / d;
	double y = ((ax*ax + ay*ay) * (cx - bx) + (bx*bx + by*by) * (ax - cx) + (cx*cx + cy*cy) * (bx - ax)) / d;
	Point p{ox + x, oy + y};
	double r = max(max(p.distance(a), p.distance(b)), p.distance(c));
	return Circle{p, r};
}
// Initially: No boundary points known
Circle makeSmallestEnclosingCircle(const vector<Point> &points) {
	// Clone list to preserve the caller's data, randomize order
	vector<Point> shuffled = points;
	std::shuffle(shuffled.begin(), shuffled.end(), randGen);
	
	// Progressively add points to circle or recompute circle
	Circle c = Circle::INVALID;
	for (size_t i = 0; i < shuffled.size(); i++) {
		const Point &p = shuffled.at(i);
		if (c.r < 0 || !c.contains(p))
			c = makeSmallestEnclosingCircleOnePoint(shuffled, i + 1, p);
	}
	return c;
}
 
 
// One boundary point known
static Circle makeSmallestEnclosingCircleOnePoint(const vector<Point> &points, size_t end, const Point &p) {
	Circle c{p, 0};
	for (size_t i = 0; i < end; i++) {
		const Point &q = points.at(i);
		if (!c.contains(q)) {
			if (c.r == 0)
				c = makeDiameter(p, q);
			else
				c = makeSmallestEnclosingCircleTwoPoints(points, i + 1, p, q);
		}
	}
	return c;
}
 
 
// Two boundary points known
static Circle makeSmallestEnclosingCircleTwoPoints(const vector<Point> &points, size_t end, const Point &p, const Point &q) {
	Circle circ = makeDiameter(p, q);
	Circle left  = Circle::INVALID;
	Circle right = Circle::INVALID;
	
	// For each point not in the two-point circle
	Point pq = q.subtract(p);
	for (size_t i = 0; i < end; i++) {
		const Point &r = points.at(i);
		if (circ.contains(r))
			continue;
		
		// Form a circumcircle and classify it on left or right side
		double cross = pq.cross(r.subtract(p));
		Circle c = makeCircumcircle(p, q, r);
		if (c.r < 0)
			continue;
		else if (cross > 0 && (left.r < 0 || pq.cross(c.c.subtract(p)) > pq.cross(left.c.subtract(p))))
			left = c;
		else if (cross < 0 && (right.r < 0 || pq.cross(c.c.subtract(p)) < pq.cross(right.c.subtract(p))))
			right = c;
	}
	
	// Select which circle to return
	if (left.r < 0 && right.r < 0)
		return circ;
	else if (left.r < 0)
		return right;
	else if (right.r < 0)
		return left;
	else
		return left.r <= right.r ? left : right;
}
 
 
 
int main() {
	ios_base::sync_with_stdio(0); cin.tie(0);    
	
    int N; cin >> N;
    vpi data(N); F0R(i, N) {
        int X, Y; cin >> X >> Y; data[i] = {X, Y};
    }
 
    vector<Point> points;
    F0R(i, N) {
        Point p;
        p.x = data[i].f;
        p.y = data[i].s;
        points.pb(p);
    }
    const vector<Point> finPoints = points;
    Circle c = makeSmallestEnclosingCircle(finPoints);
 
    cout << setprecision(20) <<  c.r << endl;
	return 0;
}
 
// read the question correctly (ll vs int)
// template by bqi343
 
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
 
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
 
using namespace std;
using namespace __gnu_pbds;
 
typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;
 
typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;
 
typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;
 
template <class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;
 
#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)
 
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
 
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
 
const int MOD = 1000000007;
const ll INF = 1e18;
const int MX = 100001; //check the limits, dummy
// SOURCE:  nayuki.io
struct Point final {
	
	public: double x;
	public: double y;
	
	
	public: Point subtract(const Point &p) const;
	
	public: double distance(const Point &p) const;
	
	// Signed area / determinant thing
	public: double cross(const Point &p) const;
	
};


struct Circle final {
	
	public: static const Circle INVALID;
	
	private: static const double MULTIPLICATIVE_EPSILON;
	
	
	public: Point c;   // Center
	public: double r;  // Radius
	
	
	public: bool contains(const Point &p) const;
	
	public: bool contains(const std::vector<Point> &ps) const;
	
};

/*---- Members of struct Point ----*/

Point Point::subtract(const Point &p) const {
	return Point{x - p.x, y - p.y};
}


double Point::distance(const Point &p) const {
	return std::hypot(x - p.x, y - p.y);
}


double Point::cross(const Point &p) const {
	return x * p.y - y * p.x;
}


/*---- Members of struct Circle ----*/

const Circle Circle::INVALID{Point{0, 0}, -1};

const double Circle::MULTIPLICATIVE_EPSILON = 1 + 1e-14;


bool Circle::contains(const Point &p) const {
	return c.distance(p) <= r * MULTIPLICATIVE_EPSILON;
}


bool Circle::contains(const vector<Point> &ps) const {
	for (const Point &p : ps) {
		if (!contains(p))
			return false;
	}
	return true;
}


/*---- Smallest enclosing circle algorithm ----*/

static Circle makeSmallestEnclosingCircleOnePoint (const vector<Point> &points, size_t end, const Point &p);
static Circle makeSmallestEnclosingCircleTwoPoints(const vector<Point> &points, size_t end, const Point &p, const Point &q);

static std::default_random_engine randGen((std::random_device())());
Circle makeDiameter(const Point &a, const Point &b) {
	Point c{(a.x + b.x) / 2, (a.y + b.y) / 2};
	return Circle{c, max(c.distance(a), c.distance(b))};
}
Circle makeCircumcircle(const Point &a, const Point &b, const Point &c) {
	// Mathematical algorithm from Wikipedia: Circumscribed circle
	double ox = (min(min(a.x, b.x), c.x) + max(min(a.x, b.x), c.x)) / 2;
	double oy = (min(min(a.y, b.y), c.y) + max(min(a.y, b.y), c.y)) / 2;
	double ax = a.x - ox,  ay = a.y - oy;
	double bx = b.x - ox,  by = b.y - oy;
	double cx = c.x - ox,  cy = c.y - oy;
	double d = (ax * (by - cy) + bx * (cy - ay) + cx * (ay - by)) * 2;
	if (d == 0)
		return Circle::INVALID;
	double x = ((ax*ax + ay*ay) * (by - cy) + (bx*bx + by*by) * (cy - ay) + (cx*cx + cy*cy) * (ay - by)) / d;
	double y = ((ax*ax + ay*ay) * (cx - bx) + (bx*bx + by*by) * (ax - cx) + (cx*cx + cy*cy) * (bx - ax)) / d;
	Point p{ox + x, oy + y};
	double r = max(max(p.distance(a), p.distance(b)), p.distance(c));
	return Circle{p, r};
}
// Initially: No boundary points known
Circle makeSmallestEnclosingCircle(const vector<Point> &points) {
	// Clone list to preserve the caller's data, randomize order
	vector<Point> shuffled = points;
	std::shuffle(shuffled.begin(), shuffled.end(), randGen);
	
	// Progressively add points to circle or recompute circle
	Circle c = Circle::INVALID;
	for (size_t i = 0; i < shuffled.size(); i++) {
		const Point &p = shuffled.at(i);
		if (c.r < 0 || !c.contains(p))
			c = makeSmallestEnclosingCircleOnePoint(shuffled, i + 1, p);
	}
	return c;
}


// One boundary point known
static Circle makeSmallestEnclosingCircleOnePoint(const vector<Point> &points, size_t end, const Point &p) {
	Circle c{p, 0};
	for (size_t i = 0; i < end; i++) {
		const Point &q = points.at(i);
		if (!c.contains(q)) {
			if (c.r == 0)
				c = makeDiameter(p, q);
			else
				c = makeSmallestEnclosingCircleTwoPoints(points, i + 1, p, q);
		}
	}
	return c;
}


// Two boundary points known
static Circle makeSmallestEnclosingCircleTwoPoints(const vector<Point> &points, size_t end, const Point &p, const Point &q) {
	Circle circ = makeDiameter(p, q);
	Circle left  = Circle::INVALID;
	Circle right = Circle::INVALID;
	
	// For each point not in the two-point circle
	Point pq = q.subtract(p);
	for (size_t i = 0; i < end; i++) {
		const Point &r = points.at(i);
		if (circ.contains(r))
			continue;
		
		// Form a circumcircle and classify it on left or right side
		double cross = pq.cross(r.subtract(p));
		Circle c = makeCircumcircle(p, q, r);
		if (c.r < 0)
			continue;
		else if (cross > 0 && (left.r < 0 || pq.cross(c.c.subtract(p)) > pq.cross(left.c.subtract(p))))
			left = c;
		else if (cross < 0 && (right.r < 0 || pq.cross(c.c.subtract(p)) < pq.cross(right.c.subtract(p))))
			right = c;
	}
	
	// Select which circle to return
	if (left.r < 0 && right.r < 0)
		return circ;
	else if (left.r < 0)
		return right;
	else if (right.r < 0)
		return left;
	else
		return left.r <= right.r ? left : right;
}



int main() {
	ios_base::sync_with_stdio(0); cin.tie(0);    
	
    int N; cin >> N;
    vpi data(N); F0R(i, N) {
        int X, Y; cin >> X >> Y; data[i] = {X, Y};
    }

    vector<Point> points;
    F0R(r, N) {
        Point p;
        p.x = data[r].f;
        p.y = data[r].s;
        points.pb(p);
    }
    const vector<Point> finPoints = points;
    Circle c = makeSmallestEnclosingCircle(finPoints);

    cout << setprecision(20) <<  c.r << endl;
	return 0;
}
 


Compiler output:
a.cc:281:9: error: redefinition of 'std::mt19937 rng'
  281 | mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
      |         ^~~
a.cc:42:9: note: 'std::mt19937 rng' previously declared here
   42 | mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
      |         ^~~
a.cc:283:11: error: redefinition of 'const int MOD'
  283 | const int MOD = 1000000007;
      |           ^~~
a.cc:44:11: note: 'const int MOD' previously defined here
   44 | const int MOD = 1000000007;
      |           ^~~
a.cc:284:10: error: redefinition of 'const ll INF'
  284 | const ll INF = 1e18;
      |          ^~~
a.cc:45:10: note: 'const ll INF' previously defined here
   45 | const ll INF = 1e18;
      |          ^~~
a.cc:285:11: error: redefinition of 'const int MX'
  285 | const int MX = 100001; //check the limits, dummy
      |           ^~
a.cc:46:11: note: 'const int MX' previously defined here
   46 | const int MX = 100001; //check the limits, dummy
      |           ^~
a.cc:287:8: error: redefinition of 'struct Point'
  287 | struct Point final {
      |        ^~~~~
a.cc:48:8: note: previous definition of 'struct Point'
   48 | struct Point final {
      |        ^~~~~
a.cc:303:8: error: redefinition of 'struct Circle'
  303 | struct Circle final {
      |        ^~~~~~
a.cc:64:8: note: previous definition of 'struct Circle'
   64 | struct Circle final {
      |        ^~~~~~
a.cc:322:7: error: no declaration matches 'Point Point::subtract(const Point&) const'
  322 | Point Point::subtract(const Point &p) const {
      |       ^~~~~
a.cc:83:7: note: candidate is: 'Point Point::subtract(const Point&) const'
   83 | Point Point::subtract(const Point &p) const {
      |       ^~~~~
a.cc:48:8: note: 'struct Point' defined here
   48 | struct Point final {
      |        ^~~~~
a.cc:327:8: error: no declaration matches 'double Point::distance(const Point&) const'
  327 | double Point::distance(const Point &p) const {
      |        ^~~~~
a.cc:88:8: note: candidate is: 'double Point::distance(const Point&) const'
   88 | double Point::distance(const Point &p) const {
      |        ^~~~~
a.cc:48:8: note: 'struct Point' defined here
   48 | struct Point final {
      |        ^~~~~
a.cc:332:8: error: no declaration matches 'double Point::cross(const Point&) const'
  332 | double Point::cross(const Point &p) const {
      |        ^~~~~
a.cc:93:8: note: candidate is: 'double Point::cross(const Point&) const'
   93 | double Point::cross(const Point &p) const {
      |        ^~~~~
a.cc:48:8: note: 'struct Point' defined here
   48 | struct Point final {
      |        ^~~~~
a.cc:339:14: error: redefinition of 'const Circle Circle::INVALID'
  339 | const Circle Circle::INVALID{Point{0, 0}, -1};
      |              ^~~~~~
a.cc:100:14: note: 'const Circle Circle::INVALID' previously defined here
  100 | const Circle Circle::INVALID{Point{0, 0}, -1};
      |              ^~~~~~
a.cc:341:14: error: redefinition of 'const double Circle::MULTIPLICATIVE_EPSILON'
  341 | const double Circle::MULTIPLICATIVE_EPSILON = 1 + 1e-14;
      |              ^~~~~~
a.cc:102:14: note: 'const double Circle::MULTIPLICATIVE_EPSILON' previously defined here
  102 | const double Circle::MULTIPLICATIVE_EPSILON = 1 + 1e-14;
      |              ^~~~~~
a.cc:344:6: error: no declaration matches 'bool Circle::contains(const Point&) const'
  344 | bool Circle::contains(const Point &p) const {
      |      ^~~~~~
a.cc:110:6: note: candidates are: 'bool Circle::contains(const std::vector<Point>&) const'
  110 | bool Circle::contains(const vector<Point> &ps) const {
      |      ^~~~~~
a.cc:105:6: note:                 'bool Circle::contains(const Point&) const'
  105 | bool Circle::contains(const Point &p) const {
      |      ^~~~~~
a.cc:64:8: note: 'struct Circle' defined here
   64 | struct Circle final {
      |        ^~~~~~
a.cc:349:6: error: no declaration matches 'bool Circle::contains(const std::vector<Point>&) const'
  349 | bool Circle::contains(const vector<Point> &ps) const {
      |      ^~~~~~
a.cc:110:6: note: candidates are: 'bool Circle::contains(const std::vector<Point>&) const'
  110 | bool Circle::contains(const vector<Point> &ps) const {
      |      ^~~~~~
a.cc:105:6: note:                 'bool Circle::contains(const Point&) const'
  105 | bool Circle::contains(const Point &p) const {
      |      ^~~~~~
a.cc:64:8: note: 'struct Circle' defined here
   64 | struct Circle final {
      |        ^~~~~~
a.cc:363:35: error: redefinition of 'std::default_random_engine randGen'
  363 | static std::default_random_engine randGen((std::random_device())());
      |                                   ^~~~~~~
a.cc:124:35: note: 'std::default_random_engine randGen' previously declared here
  124 | static std::default_random_engine randGen((std::random_device())());
      |                                   ^~~~~~~
a.cc:454:5: error: redefinition of 'int main()'
  454 | int main() {
      |     ^~~~
a.cc:215:5: note: 'int main()' previously defined here
  215 | int main() {
      |     ^~~~